spec/wcc/plugin_spec.rb in danger-wcc-0.0.5 vs spec/wcc/plugin_spec.rb in danger-wcc-0.0.6

- old
+ new

@@ -14,22 +14,25 @@ "<a href=\"github_html_link\">#{text}</a>" end end describe 'all' do - it 'runs all checks and passes default options' do - Danger::DangerWCC::CHECKS.each do |check| + it 'runs all default and passes default options' do + %i[rubocop_exceptions flay todos brakeman].each do |check| expect(@my_plugin).to receive(check) .with({}) end + %i[commit_lint reek jshint].each do |check| + expect(@my_plugin).to_not receive(check) + end # act @my_plugin.all end it 'errors if all checks disabled' do - disabled = Danger::DangerWCC::CHECKS + disabled = Danger::DangerWCC::DEFAULT_OPTIONS.keys options = disabled.each_with_object({}) { |v, h| h[v] = false; } # expect disabled.each do |check| expect(@my_plugin).to_not receive(check) @@ -40,31 +43,29 @@ @my_plugin.all(options) }.to raise_error(ArgumentError) end it 'runs only enabled checks' do - enabled = %i[todos commit_lint] - disabled = - Danger::DangerWCC::CHECKS.reject do |check| - enabled.include?(check) - end - options = disabled.each_with_object({}) { |v, h| h[v] = false; } + options = { + rubocop_exceptions: false, + todos: false, + brakeman: false, + reek: true + } # expect - enabled.each do |check| - expect(@my_plugin).to receive(check) - end - disabled.each do |check| - expect(@my_plugin).to_not receive(check) - end + expect(@my_plugin).to receive(:reek) + expect(@my_plugin).to receive(:flay) + expect(@my_plugin).to_not receive(:rubocop_exceptions) + expect(@my_plugin).to_not receive(:commit_lint) # act @my_plugin.all options end it 'passes options' do options = - Danger::DangerWCC::CHECKS.each_with_object({}) do |v, h| + Danger::DangerWCC::DEFAULT_OPTIONS.keys.each_with_object({}) do |v, h| h[v] = false end options[:commit_lint] = { test: { options: 1 } } # expect