Skip to content

Commit

Permalink
Add project_spec test to ensure that Safe: true is not given in a con…
Browse files Browse the repository at this point in the history
…fig, since it is redundant

Follow up to rubocop/rubocop#9323.
  • Loading branch information
koic committed Oct 15, 2021
1 parent e0b4fce commit 53dbc7a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spec/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,21 @@
raise errors.join("\n") unless errors.empty?
end

it 'does not have nay duplication' do
it 'does not have any duplication' do
fname = File.expand_path('../config/default.yml', __dir__)
content = File.read(fname)
RuboCop::YAMLDuplicationChecker.check(content, fname) do |key1, key2|
raise "#{fname} has duplication of #{key1.value} " \
"on line #{key1.start_line} and line #{key2.start_line}"
end
end

it 'does not include `Safe: true`' do
cop_names.each do |name|
safe = config[name]['Safe']
expect(safe).not_to eq(true), "`#{name}` has unnecessary `Safe: true` config."
end
end
end

shared_examples 'has Changelog format' do
Expand Down

0 comments on commit 53dbc7a

Please sign in to comment.