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