Merge branch 'master' of bitbucket.org:jamkazam/jam-web
This commit is contained in:
commit
a36eec81c5
|
|
@ -37,6 +37,7 @@ class ApiMusicSessionsController < ApplicationController
|
|||
|
||||
@music_session_client = MusicSessionClient.new()
|
||||
@music_session_client.ip_address = params[:ip_address]
|
||||
@music_session_client.client_id = params[:client_id]
|
||||
@music_session_client.music_session = @music_session
|
||||
@music_session_client.user = current_user
|
||||
@music_session_client.save
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
object @music_session_client
|
||||
|
||||
attributes :id, :ip_address
|
||||
attributes :id, :ip_address, :client_id
|
||||
|
|
@ -4,5 +4,5 @@ attributes :id, :description
|
|||
|
||||
child(:music_session_clients => :participants) {
|
||||
collection @music_sessions, :object_root => false
|
||||
attributes :id, :ip_address
|
||||
attributes :id, :ip_address, :client_id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ describe "Music Session API ", :type => :api do
|
|||
music_session["participants"].length.should == 0
|
||||
|
||||
# create a member
|
||||
post "/api/sessions/#{music_session["id"]}/participants.json", '{ "ip_address" : "1.2.3.4" }', "CONTENT_TYPE" => 'application/json'
|
||||
post "/api/sessions/#{music_session["id"]}/participants.json", '{ "ip_address" : "1.2.3.4", "client_id" : "1" }', "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(201)
|
||||
|
||||
musician = JSON.parse(last_response.body)
|
||||
|
|
@ -89,6 +89,9 @@ describe "Music Session API ", :type => :api do
|
|||
# and that musician should have the same IP address
|
||||
musician["ip_address"].should == "1.2.3.4"
|
||||
|
||||
# and that musician should have the same IP address
|
||||
musician["client_id"].should == "1"
|
||||
|
||||
# now delete that musician
|
||||
delete "/api/participants/#{musician["id"]}.json", '', "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(204)
|
||||
|
|
|
|||
Loading…
Reference in New Issue