Commit 84b49c70 authored by Mark Chao's avatar Mark Chao

Fix spec by testing only old case for now

Logic unchanged
parent 2b40c12c
...@@ -100,6 +100,7 @@ describe Projects::MergeRequestsController do ...@@ -100,6 +100,7 @@ describe Projects::MergeRequestsController do
let(:viewer) { user } let(:viewer) { user }
before do before do
stub_feature_flags(approval_rule: false)
sign_in(viewer) sign_in(viewer)
end end
......
...@@ -61,6 +61,7 @@ describe 'Merge request > User approves', :js do ...@@ -61,6 +61,7 @@ describe 'Merge request > User approves', :js do
context 'when CI is running but no approval given' do context 'when CI is running but no approval given' do
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
create :approver_group, group: group, target: merge_request create :approver_group, group: group, target: merge_request
pipeline = create(:ci_empty_pipeline, project: project, sha: merge_request.diff_head_sha, ref: merge_request.source_branch) pipeline = create(:ci_empty_pipeline, project: project, sha: merge_request.diff_head_sha, ref: merge_request.source_branch)
merge_request.update(head_pipeline: pipeline) merge_request.update(head_pipeline: pipeline)
......
...@@ -53,6 +53,7 @@ describe 'Merge request > User sets approvers', :js do ...@@ -53,6 +53,7 @@ describe 'Merge request > User sets approvers', :js do
let(:other_user) { create(:user) } let(:other_user) { create(:user) }
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
project.add_developer(user) project.add_developer(user)
project.add_developer(other_user) project.add_developer(other_user)
...@@ -108,6 +109,7 @@ describe 'Merge request > User sets approvers', :js do ...@@ -108,6 +109,7 @@ describe 'Merge request > User sets approvers', :js do
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
......
...@@ -14,6 +14,7 @@ describe 'User approves a merge request', :js do ...@@ -14,6 +14,7 @@ describe 'User approves a merge request', :js do
context 'when user can approve' do context 'when user can approve' do
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
visit(merge_request_path(merge_request)) visit(merge_request_path(merge_request))
end end
...@@ -30,6 +31,7 @@ describe 'User approves a merge request', :js do ...@@ -30,6 +31,7 @@ describe 'User approves a merge request', :js do
context 'when a merge request is approved additionally' do context 'when a merge request is approved additionally' do
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
project.add_developer(user2) project.add_developer(user2)
project.add_developer(user3) project.add_developer(user3)
end end
...@@ -73,6 +75,7 @@ describe 'User approves a merge request', :js do ...@@ -73,6 +75,7 @@ describe 'User approves a merge request', :js do
context 'when user cannot approve' do context 'when user cannot approve' do
before do before do
stub_feature_flags(approval_rule: false) # TODO check in !9001 when feature enabled
merge_request.approvers.create(user_id: user2.id) merge_request.approvers.create(user_id: user2.id)
visit(merge_request_path(merge_request)) visit(merge_request_path(merge_request))
......
...@@ -21,6 +21,7 @@ describe MergeRequestPresenter do ...@@ -21,6 +21,7 @@ describe MergeRequestPresenter do
let!(:approver) { create(:approver, target: resource) } let!(:approver) { create(:approver, target: resource) }
before do before do
stub_feature_flags(approval_rule: false)
resource.approvals.create!(user: approver.user) resource.approvals.create!(user: approver.user)
end end
...@@ -69,6 +70,10 @@ describe MergeRequestPresenter do ...@@ -69,6 +70,10 @@ describe MergeRequestPresenter do
subject { described_class.new(resource, current_user: user).all_approvers_including_groups } subject { described_class.new(resource, current_user: user).all_approvers_including_groups }
before do
stub_feature_flags(approval_rule: false)
end
it { is_expected.to match_array(public_approver_group.users + [approver.user]) } it { is_expected.to match_array(public_approver_group.users + [approver.user]) }
context 'when user has access to private group' do context 'when user has access to private group' do
......
...@@ -9,6 +9,8 @@ describe API::MergeRequestApprovals do ...@@ -9,6 +9,8 @@ describe API::MergeRequestApprovals do
before do before do
project.update_attribute(:approvals_before_merge, 2) project.update_attribute(:approvals_before_merge, 2)
stub_feature_flags(approval_rule: false)
end end
describe 'GET :id/merge_requests/:merge_request_iid/approvals' do describe 'GET :id/merge_requests/:merge_request_iid/approvals' do
......
...@@ -10,6 +10,10 @@ describe API::ProjectApprovals do ...@@ -10,6 +10,10 @@ describe API::ProjectApprovals do
let(:url) { "/projects/#{project.id}/approvals" } let(:url) { "/projects/#{project.id}/approvals" }
before do
stub_feature_flags(approval_rule: false)
end
describe 'GET /projects/:id/approvers' do describe 'GET /projects/:id/approvers' do
context 'when the request is correct' do context 'when the request is correct' do
before do before do
......
...@@ -73,12 +73,14 @@ describe MergeRequests::RefreshService do ...@@ -73,12 +73,14 @@ describe MergeRequests::RefreshService do
end end
end end
context 'when code owners enabled' do context 'when code owners enabled, with approval_rule disabled' do
let(:old_owners) { [] } let(:old_owners) { [] }
let(:new_owners) { [] } let(:new_owners) { [] }
let(:relevant_merge_requests) { [merge_request, another_merge_request] } let(:relevant_merge_requests) { [merge_request, another_merge_request] }
before do before do
stub_feature_flags(approval_rule: false)
relevant_merge_requests.each do |merge_request| relevant_merge_requests.each do |merge_request|
expect(::Gitlab::CodeOwners).to receive(:for_merge_request).with(merge_request).and_return(new_owners) expect(::Gitlab::CodeOwners).to receive(:for_merge_request).with(merge_request).and_return(new_owners)
expect(::Gitlab::CodeOwners).to receive(:for_merge_request).with(merge_request, merge_request_diff: anything).and_wrap_original do |m, *args| expect(::Gitlab::CodeOwners).to receive(:for_merge_request).with(merge_request, merge_request_diff: anything).and_wrap_original do |m, *args|
......
...@@ -8,6 +8,10 @@ describe MergeRequests::RemoveApprovalService do ...@@ -8,6 +8,10 @@ describe MergeRequests::RemoveApprovalService do
subject(:service) { described_class.new(project, user) } subject(:service) { described_class.new(project, user) }
before do
stub_feature_flags(approval_rule: false)
end
def execute! def execute!
service.execute(merge_request) service.execute(merge_request)
end end
......
...@@ -231,6 +231,8 @@ describe Projects::UpdateService, '#execute' do ...@@ -231,6 +231,8 @@ describe Projects::UpdateService, '#execute' do
context 'with approval_rules' do context 'with approval_rules' do
it "updates approval_rules' approvals_required" do it "updates approval_rules' approvals_required" do
stub_feature_flags(approval_rule: false)
rule = create(:approval_project_rule, project: project) rule = create(:approval_project_rule, project: project)
update_project(project, user, approvals_before_merge: 42) update_project(project, user, approvals_before_merge: 42)
......
...@@ -2442,6 +2442,8 @@ describe MergeRequest do ...@@ -2442,6 +2442,8 @@ describe MergeRequest do
let(:stranger) { create(:user) } let(:stranger) { create(:user) }
before do before do
stub_feature_flags(approval_rule: false)
project.add_developer(author) project.add_developer(author)
project.add_developer(approver) project.add_developer(approver)
project.add_developer(approver_2) project.add_developer(approver_2)
......
...@@ -19,6 +19,8 @@ describe MergeRequests::UpdateService, :mailer do ...@@ -19,6 +19,8 @@ describe MergeRequests::UpdateService, :mailer do
end end
before do before do
stub_feature_flags(approval_rule: false)
project.add_maintainer(user) project.add_maintainer(user)
project.add_developer(user2) project.add_developer(user2)
project.add_developer(user3) project.add_developer(user3)
......
...@@ -1308,6 +1308,7 @@ describe NotificationService, :mailer do ...@@ -1308,6 +1308,7 @@ describe NotificationService, :mailer do
let(:project_approvers) { create_list(:user, 3) } let(:project_approvers) { create_list(:user, 3) }
before do before do
stub_feature_flags(approval_rule: false)
merge_request.target_project.update(approvals_before_merge: 1) merge_request.target_project.update(approvals_before_merge: 1)
project_approvers.each { |approver| create(:approver, user: approver, target: merge_request.target_project) } project_approvers.each { |approver| create(:approver, user: approver, target: merge_request.target_project) }
end end
......
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