Commit 8ff171f6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix api specs

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent e8f222e3
...@@ -93,7 +93,7 @@ describe API::API, api: true do ...@@ -93,7 +93,7 @@ describe API::API, api: true do
post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!'
response.status.should == 201 response.status.should == 201
json_response['body'].should == 'hi!' json_response['body'].should == 'hi!'
json_response['author']['email'].should == user.email json_response['author']['username'].should == user.username
end end
it "should return a 400 bad request error if body not given" do it "should return a 400 bad request error if body not given" do
...@@ -112,7 +112,7 @@ describe API::API, api: true do ...@@ -112,7 +112,7 @@ describe API::API, api: true do
post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!' post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!'
response.status.should == 201 response.status.should == 201
json_response['body'].should == 'hi!' json_response['body'].should == 'hi!'
json_response['author']['email'].should == user.email json_response['author']['username'].should == user.username
end end
it "should return a 400 bad request error if body not given" do it "should return a 400 bad request error if body not given" do
......
...@@ -21,7 +21,7 @@ describe API::API, api: true do ...@@ -21,7 +21,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.count.should == 2 json_response.count.should == 2
json_response.map { |u| u['email'] }.should include user.email json_response.map { |u| u['username'] }.should include user.username
end end
it "finds team members with query string" do it "finds team members with query string" do
...@@ -29,7 +29,7 @@ describe API::API, api: true do ...@@ -29,7 +29,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.count.should == 1 json_response.count.should == 1
json_response.first['email'].should == user.email json_response.first['username'].should == user.username
end end
it "should return a 404 error if id not found" do it "should return a 404 error if id not found" do
...@@ -44,7 +44,7 @@ describe API::API, api: true do ...@@ -44,7 +44,7 @@ describe API::API, api: true do
it "should return project team member" do it "should return project team member" do
get api("/projects/#{project.id}/members/#{user.id}", user) get api("/projects/#{project.id}/members/#{user.id}", user)
response.status.should == 200 response.status.should == 200
json_response['email'].should == user.email json_response['username'].should == user.username
json_response['access_level'].should == UsersProject::MASTER json_response['access_level'].should == UsersProject::MASTER
end end
...@@ -62,7 +62,7 @@ describe API::API, api: true do ...@@ -62,7 +62,7 @@ describe API::API, api: true do
}.to change { UsersProject.count }.by(1) }.to change { UsersProject.count }.by(1)
response.status.should == 201 response.status.should == 201
json_response['email'].should == user2.email json_response['username'].should == user2.username
json_response['access_level'].should == UsersProject::DEVELOPER json_response['access_level'].should == UsersProject::DEVELOPER
end end
...@@ -75,7 +75,7 @@ describe API::API, api: true do ...@@ -75,7 +75,7 @@ describe API::API, api: true do
}.not_to change { UsersProject.count }.by(1) }.not_to change { UsersProject.count }.by(1)
response.status.should == 201 response.status.should == 201
json_response['email'].should == user2.email json_response['username'].should == user2.username
json_response['access_level'].should == UsersProject::DEVELOPER json_response['access_level'].should == UsersProject::DEVELOPER
end end
...@@ -101,7 +101,7 @@ describe API::API, api: true do ...@@ -101,7 +101,7 @@ describe API::API, api: true do
it "should update project team member" do it "should update project team member" do
put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER
response.status.should == 200 response.status.should == 200
json_response['email'].should == user3.email json_response['username'].should == user3.username
json_response['access_level'].should == UsersProject::MASTER json_response['access_level'].should == UsersProject::MASTER
end end
......
...@@ -37,7 +37,7 @@ describe API::API, api: true do ...@@ -37,7 +37,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.first['name'].should == project.name json_response.first['name'].should == project.name
json_response.first['owner']['email'].should == user.email json_response.first['owner']['username'].should == user.username
end end
end end
end end
...@@ -65,7 +65,7 @@ describe API::API, api: true do ...@@ -65,7 +65,7 @@ describe API::API, api: true do
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
json_response.first['name'].should == project.name json_response.first['name'].should == project.name
json_response.first['owner']['email'].should == user.email json_response.first['owner']['username'].should == user.username
end end
end end
end end
...@@ -270,7 +270,7 @@ describe API::API, api: true do ...@@ -270,7 +270,7 @@ describe API::API, api: true do
get api("/projects/#{project.id}", user) get api("/projects/#{project.id}", user)
response.status.should == 200 response.status.should == 200
json_response['name'].should == project.name json_response['name'].should == project.name
json_response['owner']['email'].should == user.email json_response['owner']['username'].should == user.username
end end
it "should return a project by path name" do it "should return a project by path name" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment