Commit 1d54e5f0 authored by Kerri Miller's avatar Kerri Miller

Add spec testing owner_line parsing

parent cb3ca8c6
...@@ -69,10 +69,10 @@ describe Gitlab::CodeOwners::File do ...@@ -69,10 +69,10 @@ describe Gitlab::CodeOwners::File do
expect(data.keys).to contain_exactly("codeowners", "Documentation", "Database") expect(data.keys).to contain_exactly("codeowners", "Documentation", "Database")
end end
where(:section, :patterns) do where(:section, :patterns, :owners) do
"codeowners" | ["/**/ee/**/*"] "codeowners" | ["/**/ee/**/*"] | ["@gl-admin"]
"Documentation" | ["/**/README.md", "/**/ee/docs", "/**/docs"] "Documentation" | ["/**/README.md", "/**/ee/docs", "/**/docs"] | ["@gl-docs"]
"Database" | ["/**/README.md", "/**/model/db"] "Database" | ["/**/README.md", "/**/model/db"] | ["@gl-database"]
end end
with_them do with_them do
...@@ -80,6 +80,11 @@ describe Gitlab::CodeOwners::File do ...@@ -80,6 +80,11 @@ describe Gitlab::CodeOwners::File do
expect(file.parsed_data[section].keys).to contain_exactly(*patterns) expect(file.parsed_data[section].keys).to contain_exactly(*patterns)
expect(file.parsed_data[section].values.detect { |entry| entry.section != section }).to be_nil expect(file.parsed_data[section].values.detect { |entry| entry.section != section }).to be_nil
end end
it "assigns the correct owners for each entry" do
extracted_owners = file.parsed_data[section].values.collect(&:owner_line).uniq
expect(extracted_owners).to contain_exactly(*owners)
end
end 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