spec/rubocop/cop/rspec/be_eql_spec.rb in rubocop-rspec-1.7.0 vs spec/rubocop/cop/rspec/be_eql_spec.rb in rubocop-rspec-1.8.0

- old
+ new

@@ -33,10 +33,17 @@ it { expect(foo).to eql(:foo) } ^^^ Prefer `be` over `eql` RUBY end + it 'registers an offense for `eql` when argument is nil' do + expect_violation(<<-RUBY) + it { expect(foo).to eql(nil) } + ^^^ Prefer `be` over `eql` + RUBY + end + it 'does not register an offense for `eql` when argument is a string' do expect_no_violations(<<-RUBY) it { expect(foo).to eql('foo') } RUBY end @@ -45,15 +52,9 @@ expect_no_violations(<<-RUBY) it { expect(foo).to_not eql(1) } RUBY end - it 'autocorrects offense to use `be`' do - corrected = - autocorrect_source( - cop, - ['it { expect(foo).to eql(1) }'], - 'spec/foo_spec.rb' - ) - expect(corrected).to eq 'it { expect(foo).to be(1) }' - end + include_examples 'autocorrect', + 'it { expect(foo).to eql(1) }', + 'it { expect(foo).to be(1) }' end