spec/rubocop/cop/rspec/implicit_expect_spec.rb in rubocop-rspec-1.32.0 vs spec/rubocop/cop/rspec/implicit_expect_spec.rb in rubocop-rspec-1.33.0

- old
+ new

@@ -11,17 +11,25 @@ it 'flags it { should }' do expect_offense(<<-RUBY) it { should be_truthy } ^^^^^^ Prefer `is_expected.to` over `should`. RUBY + + expect_correction(<<-RUBY) + it { is_expected.to be_truthy } + RUBY end it 'flags it { should_not }' do expect_offense(<<-RUBY) it { should_not be_truthy } ^^^^^^^^^^ Prefer `is_expected.to_not` over `should_not`. RUBY + + expect_correction(<<-RUBY) + it { is_expected.to_not be_truthy } + RUBY end it 'approves of is_expected.to' do expect_no_offenses('it { is_expected.to be_truthy }') end @@ -33,17 +41,10 @@ it 'approves of is_expected.not_to' do expect_no_offenses('it { is_expected.not_to be_truthy }') end include_examples 'detects style', 'it { should be_truthy }', 'should' - include_examples 'autocorrect', - 'it { should be_truthy }', - 'it { is_expected.to be_truthy }' - - include_examples 'autocorrect', - 'it { should_not be_truthy }', - 'it { is_expected.to_not be_truthy }' end context 'when EnforcedStyle is should' do let(:cop_config) do { 'EnforcedStyle' => 'should' } @@ -52,24 +53,36 @@ it 'flags it { is_expected.to }' do expect_offense(<<-RUBY) it { is_expected.to be_truthy } ^^^^^^^^^^^^^^ Prefer `should` over `is_expected.to`. RUBY + + expect_correction(<<-RUBY) + it { should be_truthy } + RUBY end it 'flags it { is_expected.to_not }' do expect_offense(<<-RUBY) it { is_expected.to_not be_truthy } ^^^^^^^^^^^^^^^^^^ Prefer `should_not` over `is_expected.to_not`. RUBY + + expect_correction(<<-RUBY) + it { should_not be_truthy } + RUBY end it 'flags it { is_expected.not_to }' do expect_offense(<<-RUBY) it { is_expected.not_to be_truthy } ^^^^^^^^^^^^^^^^^^ Prefer `should_not` over `is_expected.not_to`. RUBY + + expect_correction(<<-RUBY) + it { should_not be_truthy } + RUBY end it 'approves of should' do expect_no_offenses('it { should be_truthy }') end @@ -83,19 +96,7 @@ 'is_expected' include_examples 'detects style', 'it { should be_truthy }', 'should' - - include_examples 'autocorrect', - 'it { is_expected.to be_truthy }', - 'it { should be_truthy }' - - include_examples 'autocorrect', - 'it { is_expected.to_not be_truthy }', - 'it { should_not be_truthy }' - - include_examples 'autocorrect', - 'it { is_expected.not_to be_truthy }', - 'it { should_not be_truthy }' end end