Created
January 19, 2011 06:50
-
-
Save davidyang/785793 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "creates Visits and Patients" do | |
before(:all) do | |
ActiveRecord::Base.connection.begin_db_transaction | |
@query = Factory.create(:query) | |
@params = {} | |
@params[:practice_key] = @query.functionality.practice.subdomain_key | |
@params[:query_id] = @query.id | |
Visit.stub!(:strip_time_zone).and_return(Time.zone.now.tomorrow.to_s) | |
end | |
it "should create two new Patients and Visits" do | |
#Patient.should_receive(:create).twice | |
do_post('upload_xml_011411.xml', @params) | |
Patient.count.should == 2 | |
Visit.count.should == 2 | |
VoiceNotification.count.should == 0 | |
EmailNotification.count.should == 0 | |
# generate both email and voice notifications | |
@query.email_active = true | |
@query.actively_notify = true | |
@query.create_notifications | |
VoiceNotification.count.should == 2 | |
EmailNotification.count.should == 2 | |
@query.create_notifications | |
EmailNotification.should_not_receive(:create) | |
VoiceNotification.should_not_receive(:create) | |
end | |
it "should not create notifications for various reasons" do | |
do_post('upload_xml_011411.xml', @params) | |
Patient.count.should == 2 | |
end | |
after(:all) do | |
ActiveRecord::Base.connection.rollback_db_transaction | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment