Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/spec/controllers/api/events_controller_spec.rb b/spec/controllers/api/events_controller_spec.rb
- index 32d0280..0f4872f 100644
- --- a/spec/controllers/api/events_controller_spec.rb
- +++ b/spec/controllers/api/events_controller_spec.rb
- @@ -7,7 +7,7 @@ describe Api::EventsController do
- let(:api_user){ Factory.create(:user, :username => 'api_user', :password => 'Test1234') }
- let(:lab){ Factory.create(:lab, :code_name => SecureRandom.hex(4), :name => "Test Lab") }
- - let(:event){ Factory.create(:screening_event, :code => SecureRandom.hex(4), :secondary_code => SecureRandom.hex(4) ,:lab => lab, :starts_at => 1.day.from_now) }
- + let(:event){ Factory.create(:screening_event, :code => SecureRandom.hex(4), :secondary_code => SecureRandom.hex(4) ,:lab => lab, :starts_at => 1.day.from_now, :id => 123) }
- describe "GET /api/events/metadata.json" do
- context "with no credentials" do
- @@ -48,10 +48,7 @@ describe Api::EventsController do
- before do
- controller.stub!(:current_user).and_return(api_user)
- api_user.stub!(:is_nurse_for_what).and_return([lab])
- - lab.stub_chain(:events, :find_by_code).and_return(nil)
- - lab.stub_chain(:events, :find_by_code).with(event.code).and_return(event)
- - lab.stub_chain(:events, :find_by_secondary_code).and_return(nil)
- - lab.stub_chain(:events, :find_by_secondary_code).with(event.secondary_code).and_return(event)
- + lab.stub_chain(:events, :map, :compact).and_return([event])
- end
- context "without an event code" do
- @@ -107,7 +104,7 @@ describe Api::EventsController do
- before do
- controller.stub!(:current_user).and_return(api_user)
- api_user.stub!(:is_nurse_for_what).and_return([lab])
- - lab.stub_chain(:events, :find_by_id).and_return(event)
- + lab.stub_chain(:events, :map, :compact).and_return([event])
- end
- it "returns a status of 200 and lists the participants" do
- @@ -149,7 +146,7 @@ describe Api::EventsController do
- before do
- controller.stub!(:current_user).and_return(api_user)
- api_user.stub!(:is_nurse_for_what).and_return([lab])
- - lab.stub_chain(:events, :find_by_id).and_return(event)
- + lab.stub_chain(:events, :map, :compact).and_return([event])
- end
- it "returns a status of 200 and lists the participants matching 'Joe'" do
- @@ -205,6 +202,7 @@ describe Api::EventsController do
- before do
- controller.stub!(:current_user).and_return(api_user)
- api_user.stub!(:is_nurse_for_what).and_return([lab])
- + lab.stub_chain(:events, :map, :compact).and_return([event])
- lab.stub_chain(:events, :find).and_return([event])
- end
Add Comment
Please, Sign In to add comment