Commit 8ff171f62849d5e418847c1751a802f93604cc61

Authored by Dmitriy Zaporozhets
1 parent e8f222e3

Fix api specs

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
spec/requests/api/notes_spec.rb
@@ -93,7 +93,7 @@ describe API::API, api: true do @@ -93,7 +93,7 @@ describe API::API, api: true do
93 post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!' 93 post api("/projects/#{project.id}/issues/#{issue.id}/notes", user), body: 'hi!'
94 response.status.should == 201 94 response.status.should == 201
95 json_response['body'].should == 'hi!' 95 json_response['body'].should == 'hi!'
96 - json_response['author']['email'].should == user.email 96 + json_response['author']['username'].should == user.username
97 end 97 end
98 98
99 it "should return a 400 bad request error if body not given" do 99 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
112 post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!' 112 post api("/projects/#{project.id}/snippets/#{snippet.id}/notes", user), body: 'hi!'
113 response.status.should == 201 113 response.status.should == 201
114 json_response['body'].should == 'hi!' 114 json_response['body'].should == 'hi!'
115 - json_response['author']['email'].should == user.email 115 + json_response['author']['username'].should == user.username
116 end 116 end
117 117
118 it "should return a 400 bad request error if body not given" do 118 it "should return a 400 bad request error if body not given" do
spec/requests/api/project_members_spec.rb
@@ -21,7 +21,7 @@ describe API::API, api: true do @@ -21,7 +21,7 @@ describe API::API, api: true do
21 response.status.should == 200 21 response.status.should == 200
22 json_response.should be_an Array 22 json_response.should be_an Array
23 json_response.count.should == 2 23 json_response.count.should == 2
24 - json_response.map { |u| u['email'] }.should include user.email 24 + json_response.map { |u| u['username'] }.should include user.username
25 end 25 end
26 26
27 it "finds team members with query string" do 27 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
29 response.status.should == 200 29 response.status.should == 200
30 json_response.should be_an Array 30 json_response.should be_an Array
31 json_response.count.should == 1 31 json_response.count.should == 1
32 - json_response.first['email'].should == user.email 32 + json_response.first['username'].should == user.username
33 end 33 end
34 34
35 it "should return a 404 error if id not found" do 35 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
44 it "should return project team member" do 44 it "should return project team member" do
45 get api("/projects/#{project.id}/members/#{user.id}", user) 45 get api("/projects/#{project.id}/members/#{user.id}", user)
46 response.status.should == 200 46 response.status.should == 200
47 - json_response['email'].should == user.email 47 + json_response['username'].should == user.username
48 json_response['access_level'].should == UsersProject::MASTER 48 json_response['access_level'].should == UsersProject::MASTER
49 end 49 end
50 50
@@ -62,7 +62,7 @@ describe API::API, api: true do @@ -62,7 +62,7 @@ describe API::API, api: true do
62 }.to change { UsersProject.count }.by(1) 62 }.to change { UsersProject.count }.by(1)
63 63
64 response.status.should == 201 64 response.status.should == 201
65 - json_response['email'].should == user2.email 65 + json_response['username'].should == user2.username
66 json_response['access_level'].should == UsersProject::DEVELOPER 66 json_response['access_level'].should == UsersProject::DEVELOPER
67 end 67 end
68 68
@@ -75,7 +75,7 @@ describe API::API, api: true do @@ -75,7 +75,7 @@ describe API::API, api: true do
75 }.not_to change { UsersProject.count }.by(1) 75 }.not_to change { UsersProject.count }.by(1)
76 76
77 response.status.should == 201 77 response.status.should == 201
78 - json_response['email'].should == user2.email 78 + json_response['username'].should == user2.username
79 json_response['access_level'].should == UsersProject::DEVELOPER 79 json_response['access_level'].should == UsersProject::DEVELOPER
80 end 80 end
81 81
@@ -101,7 +101,7 @@ describe API::API, api: true do @@ -101,7 +101,7 @@ describe API::API, api: true do
101 it "should update project team member" do 101 it "should update project team member" do
102 put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER 102 put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER
103 response.status.should == 200 103 response.status.should == 200
104 - json_response['email'].should == user3.email 104 + json_response['username'].should == user3.username
105 json_response['access_level'].should == UsersProject::MASTER 105 json_response['access_level'].should == UsersProject::MASTER
106 end 106 end
107 107
spec/requests/api/projects_spec.rb
@@ -37,7 +37,7 @@ describe API::API, api: true do @@ -37,7 +37,7 @@ describe API::API, api: true do
37 response.status.should == 200 37 response.status.should == 200
38 json_response.should be_an Array 38 json_response.should be_an Array
39 json_response.first['name'].should == project.name 39 json_response.first['name'].should == project.name
40 - json_response.first['owner']['email'].should == user.email 40 + json_response.first['owner']['username'].should == user.username
41 end 41 end
42 end 42 end
43 end 43 end
@@ -65,7 +65,7 @@ describe API::API, api: true do @@ -65,7 +65,7 @@ describe API::API, api: true do
65 response.status.should == 200 65 response.status.should == 200
66 json_response.should be_an Array 66 json_response.should be_an Array
67 json_response.first['name'].should == project.name 67 json_response.first['name'].should == project.name
68 - json_response.first['owner']['email'].should == user.email 68 + json_response.first['owner']['username'].should == user.username
69 end 69 end
70 end 70 end
71 end 71 end
@@ -270,7 +270,7 @@ describe API::API, api: true do @@ -270,7 +270,7 @@ describe API::API, api: true do
270 get api("/projects/#{project.id}", user) 270 get api("/projects/#{project.id}", user)
271 response.status.should == 200 271 response.status.should == 200
272 json_response['name'].should == project.name 272 json_response['name'].should == project.name
273 - json_response['owner']['email'].should == user.email 273 + json_response['owner']['username'].should == user.username
274 end 274 end
275 275
276 it "should return a project by path name" do 276 it "should return a project by path name" do