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