diff --git a/web/spec/controllers/api_jam_tracks_controller_spec.rb b/web/spec/controllers/api_jam_tracks_controller_spec.rb index 31101592c..62bd151e9 100644 --- a/web/spec/controllers/api_jam_tracks_controller_spec.rb +++ b/web/spec/controllers/api_jam_tracks_controller_spec.rb @@ -157,18 +157,18 @@ describe ApiJamTracksController do describe "keys" do it "empty" do - get :keys, jamtracks: [] + get :keys, jamtracks: {tracks: []} response.status.should == 200 json = JSON.parse(response.body) json.length == 0 end it "track with no rights" do - get :keys, jamtracks: [@jam_track.id] + get :keys, jamtracks: { tracks: [@jam_track.id] } response.status.should == 200 json = JSON.parse(response.body) json.length.should == 1 - json[0]['id'].should == @jam_track.id + json[0]['id'].should == @jam_track.id.to_s json[0]['private'].should be_nil json[0]['error'].should == 'not_purchased' end @@ -177,32 +177,32 @@ describe ApiJamTracksController do right = FactoryGirl.create(:jam_track_right, user: @user, private_key: nil, jam_track: @jam_track) - get :keys, jamtracks: [@jam_track.id] + get :keys, jamtracks: { tracks: [@jam_track.id] } response.status.should == 200 json = JSON.parse(response.body) json.length.should == 1 - json[0]['id'].should == @jam_track.id + json[0]['id'].should == @jam_track.id.to_s json[0]['private'].should be_nil json[0]['error'].should == 'no_key' end it "track with key" do right = FactoryGirl.create(:jam_track_right, user: @user, private_key: 'abc', jam_track: @jam_track) - get :keys, jamtracks: [@jam_track.id] + get :keys, jamtracks: { tracks: [@jam_track.id] } response.status.should == 200 json = JSON.parse(response.body) json.length.should == 1 - json[0]['id'].should == @jam_track.id + json[0]['id'].should == @jam_track.id.to_s json[0]['private'].should eq('abc') json[0]['error'].should be_nil end it "non-owning user asking for a real track" do right = FactoryGirl.create(:jam_track_right, user: FactoryGirl.create(:user), private_key: 'abc', jam_track: @jam_track) - get :keys, jamtracks: [@jam_track.id] + get :keys, jamtracks: { tracks: [@jam_track.id] } response.status.should == 200 json = JSON.parse(response.body) - json[0]['id'].should == @jam_track.id + json[0]['id'].should == @jam_track.id.to_s json[0]['private'].should be_nil json[0]['error'].should == 'not_purchased' end