Skip to content

Commit

Permalink
Add test for the measurement_sessions_controller#show_multiple endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
czorek committed Oct 5, 2016
1 parent b102dd2 commit 038a8d2
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions spec/controllers/api/measurement_sessions_controller_spec.rb
Expand Up @@ -62,6 +62,33 @@
it { should respond_with(:ok) }
end

describe "GET 'show'" do
let(:session) { FactoryGirl.create(:mobile_session) }

before do
get :show, :id => session.id, :format => :json
end

it { should respond_with(:ok) }
it "should contain notes" do
json_response['notes'].should == jsonized(session.notes)
end
end

describe "GET 'show_multiple'" do
let(:session1) { FactoryGirl.create(:mobile_session) }
let(:session2) { FactoryGirl.create(:mobile_session) }

before do
get :show_multiple, q: { session_ids: [session1.id, session2.id] }, format: :json
end

it { expect(response.status).to eq 200 }
it 'returns multiple sessions' do
expect(response.body).to eq MobileSession.selected_sessions_json(session_ids: [session1.id, session2.id]).to_json
end
end

describe "POST 'create'" do
let(:builder) { stub }
let(:data) { {type: "MobileSession"} }
Expand Down Expand Up @@ -91,17 +118,4 @@
it_should_behave_like "session creation"
end
end

describe "GET 'show'" do
let(:session) { FactoryGirl.create(:mobile_session) }

before do
get :show, :id => session.id, :format => :json
end

it { should respond_with(:ok) }
it "should contain notes" do
json_response['notes'].should == jsonized(session.notes)
end
end
end

0 comments on commit 038a8d2

Please sign in to comment.