From eaf66e3ec153ede3885ee240195dfbee763c9862 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Sun, 7 Jan 2018 02:24:24 +0100 Subject: [PATCH] Enable RSpec/IteratedExpectation cop and fix issues Suggested refactor is only available for `.to` and not for `.not_to` :( Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation --- .rubocop.yml | 3 +++ spec/features/moderation/comments_spec.rb | 4 +--- spec/features/moderation/debates_spec.rb | 4 +--- spec/features/moderation/proposals_spec.rb | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 388fba593..e8376a710 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -108,4 +108,7 @@ RSpec/InvalidPredicateMatcher: Enabled: true RSpec/ItBehavesLike: + Enabled: true + +RSpec/IteratedExpectation: Enabled: true \ No newline at end of file diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index ea6821a8d..2bf89bfaa 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -90,9 +90,7 @@ feature 'Moderate comments' do within('.js-check') { click_on 'All' } - all('input[type=checkbox]').each do |checkbox| - expect(checkbox).to be_checked - end + expect(all('input[type=checkbox]')).to all(be_checked) within('.js-check') { click_on 'None' } diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb index a642eb0a4..f62ccd76b 100644 --- a/spec/features/moderation/debates_spec.rb +++ b/spec/features/moderation/debates_spec.rb @@ -99,9 +99,7 @@ feature 'Moderate debates' do within('.js-check') { click_on 'All' } - all('input[type=checkbox]').each do |checkbox| - expect(checkbox).to be_checked - end + expect(all('input[type=checkbox]')).to all(be_checked) within('.js-check') { click_on 'None' } diff --git a/spec/features/moderation/proposals_spec.rb b/spec/features/moderation/proposals_spec.rb index df0a92395..eb2e0e247 100644 --- a/spec/features/moderation/proposals_spec.rb +++ b/spec/features/moderation/proposals_spec.rb @@ -99,9 +99,7 @@ feature 'Moderate proposals' do within('.js-check') { click_on 'All' } - all('input[type=checkbox]').each do |checkbox| - expect(checkbox).to be_checked - end + expect(all('input[type=checkbox]')).to all(be_checked) within('.js-check') { click_on 'None' }