Merge branch 'master' of bitbucket.org:jamkazam/jam-web
This commit is contained in:
commit
04d059368a
|
|
@ -1,6 +1,7 @@
|
|||
object @join_request
|
||||
|
||||
attributes :id, :text
|
||||
attributes :music_session_id => :music_session
|
||||
|
||||
child(:user => :user) {
|
||||
attributes :id, :name
|
||||
|
|
|
|||
|
|
@ -78,4 +78,17 @@ describe "Join Request API", :type => :api do
|
|||
get "/api/join_requests/#{join_request["id"]}.json", "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should == 404
|
||||
end
|
||||
|
||||
it "can't create duplicate join_request" do
|
||||
login(other)
|
||||
|
||||
post '/api/join_requests.json', { :music_session => user.music_sessions[0].id, :text => "lemme in" }.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should == 201
|
||||
join_request = JSON.parse(last_response.body)
|
||||
|
||||
post '/api/join_requests.json', { :music_session => user.music_sessions[0].id, :text => "lemme in" }.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should == 422
|
||||
join_request = JSON.parse(last_response.body)
|
||||
join_request["errors"]["user_id"].should == ["has already been taken"]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ describe "Music Session API ", :type => :api do
|
|||
|
||||
get last_response.headers["Location"] + ".json", "CONTENT_TYPE" => 'application/json'
|
||||
join_request = JSON.parse(last_response.body)
|
||||
|
||||
|
||||
# pop back to user1 and allow user2 to get in
|
||||
login(user)
|
||||
post '/api/invitations.json', {:music_session => music_session["id"], :receiver => user2.id, :join_request => join_request["id"]}.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
|
|
|
|||
Loading…
Reference in New Issue