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
subject
end
context 'when :sectional_codeowners is disabled' do
before do
stub_feature_flags(sectional_codeowners: false)
context "creating approval_rules" do
shared_examples_for 'creates an approval rule based on current diff' do
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
it 'creates an approval rule based on current diff' do
file = File.read(Rails.root.join('ee', 'spec', 'fixtures', 'codeowners_example'))
before do
project.repository.create_file(owner, 'CODEOWNERS', file, { branch_name: 'test', message: 'codeowners' })
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)
expect(another_merge_request.approval_rules.first.rule_type).to eq('code_owner')
it_behaves_like 'creates an approval rule based on current diff' do
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
......
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