Commit 419b9a45 authored by Kerri Miller's avatar Kerri Miller

Add additional sectional-codeowners test

parent a81bba38
...@@ -95,19 +95,38 @@ describe MergeRequests::RefreshService do ...@@ -95,19 +95,38 @@ describe MergeRequests::RefreshService do
subject subject
end end
context 'when :sectional_codeowners is disabled' do context "creating approval_rules" do
before do shared_examples_for 'creates an approval rule based on current diff' do
stub_feature_flags(sectional_codeowners: false) it "creates expected approval rules" do
expect(another_merge_request.approval_rules.size).to eq(approval_rules_size)
expect(another_merge_request.approval_rules.first.rule_type).to eq('code_owner')
end
end end
it 'creates an approval rule based on current diff' do before do
file = File.read(Rails.root.join('ee', 'spec', 'fixtures', 'codeowners_example'))
project.repository.create_file(owner, 'CODEOWNERS', file, { branch_name: 'test', message: 'codeowners' }) project.repository.create_file(owner, 'CODEOWNERS', file, { branch_name: 'test', message: 'codeowners' })
subject subject
end
context 'with a non-sectional codeowners file' do
let_it_be(:file) do
File.read(Rails.root.join('ee', 'spec', 'fixtures', 'codeowners_example'))
end
expect(another_merge_request.approval_rules.size).to eq(3) it_behaves_like 'creates an approval rule based on current diff' do
expect(another_merge_request.approval_rules.first.rule_type).to eq('code_owner') let(:approval_rules_size) { 3 }
end
end
context 'with a sectional codeowners file' do
let_it_be(:file) do
File.read(Rails.root.join('ee', 'spec', 'fixtures', 'sectional_codeowners_example'))
end
it_behaves_like 'creates an approval rule based on current diff' do
let(:approval_rules_size) { 4 }
end
end end
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