Skip to content
Snippets Groups Projects
Verified Commit 8ff171f6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix api specs

parent e8f222e3
Branches
Tags
No related merge requests found
Loading
@@ -93,7 +93,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
@@ -112,7 +112,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
Loading
Loading
@@ -21,7 +21,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
@@ -29,7 +29,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
@@ -44,7 +44,7 @@ describe API::API, api: true do
Loading
@@ -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
   
Loading
@@ -62,7 +62,7 @@ describe API::API, api: true do
Loading
@@ -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
   
Loading
@@ -75,7 +75,7 @@ describe API::API, api: true do
Loading
@@ -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
   
Loading
@@ -101,7 +101,7 @@ describe API::API, api: true do
Loading
@@ -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
   
Loading
Loading
Loading
@@ -37,7 +37,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
@@ -65,7 +65,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
@@ -270,7 +270,7 @@ describe API::API, api: true do
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment