Commit 4d675052 authored by Rémy Coutable's avatar Rémy Coutable

Fix failing specs after project authorizations rework

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 61b861cc
...@@ -23,8 +23,8 @@ describe AutocompleteController do ...@@ -23,8 +23,8 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) } it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 2 } it { expect(body.size).to eq 3 }
it { expect(body.map { |u| u["username"] }).to match_array([user.username, user2.username]) } it { expect(body.map { |u| u["username"] }).to match_array([project.owner.username, user.username, user2.username]) }
end end
describe 'GET #users with unknown project' do describe 'GET #users with unknown project' do
...@@ -43,8 +43,8 @@ describe AutocompleteController do ...@@ -43,8 +43,8 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) } it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 1 } it { expect(body.size).to eq 2 }
it { expect(body.first["username"]).to eq user.username } it { expect(body.map { |u| u["username"] }).to match_array([project.owner.username, user.username]) }
end end
describe "GET #users that can push code" do describe "GET #users that can push code" do
...@@ -58,8 +58,8 @@ describe AutocompleteController do ...@@ -58,8 +58,8 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) } it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 2 } it { expect(body.size).to eq 3 }
it { expect(body.map { |user| user["username"] }).to match_array([user.username, user2.username]) } it { expect(body.map { |user| user["username"] }).to match_array([project.owner.username, user.username, user2.username]) }
end end
describe "GET #users that can push to protected branches, including the current user" do describe "GET #users that can push to protected branches, including the current user" do
...@@ -70,8 +70,8 @@ describe AutocompleteController do ...@@ -70,8 +70,8 @@ describe AutocompleteController do
let(:body) { JSON.parse(response.body) } let(:body) { JSON.parse(response.body) }
it { expect(body).to be_kind_of(Array) } it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 1 } it { expect(body.size).to eq 2 }
it { expect(body.first["username"]).to eq user.username } it { expect(body.map { |u| u["username"] }).to match_array([project.owner.username, user.username]) }
end end
end end
......
...@@ -289,7 +289,7 @@ describe Projects::MergeRequestsController do ...@@ -289,7 +289,7 @@ describe Projects::MergeRequestsController do
recorded = ActiveRecord::QueryRecorder.new { go(format: :json) } recorded = ActiveRecord::QueryRecorder.new { go(format: :json) }
expect(recorded.count).to be_within(5).of(95) expect(recorded.count).to be_within(10).of(100)
expect(recorded.cached_count).to eq(0) expect(recorded.cached_count).to eq(0)
end end
end end
......
...@@ -564,7 +564,7 @@ describe MergeRequest, models: true do ...@@ -564,7 +564,7 @@ describe MergeRequest, models: true do
project.team << [developer, :developer] project.team << [developer, :developer]
project.team << [blocked_developer, :developer] project.team << [blocked_developer, :developer]
expect(merge_request.number_of_potential_approvers).to eq(1) expect(merge_request.number_of_potential_approvers).to eq(2)
end end
context "when the project is part of a group" do context "when the project is part of a group" do
...@@ -1520,7 +1520,7 @@ describe MergeRequest, models: true do ...@@ -1520,7 +1520,7 @@ describe MergeRequest, models: true do
end end
it 'does not require approval for the merge request' do it 'does not require approval for the merge request' do
expect(merge_request.approvals_left).to eq(0) expect(merge_request.approvals_left).to eq(1)
end end
it 'does not allow the approver to approve the MR' do it 'does not allow the approver to approve the MR' 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