spec/rubocop/cop/rspec/predicate_matcher_spec.rb in rubocop-rspec-1.24.0 vs spec/rubocop/cop/rspec/predicate_matcher_spec.rb in rubocop-rspec-1.25.0

- old
+ new

@@ -7,11 +7,11 @@ end context 'when enforced style is `inflected`' do let(:enforced_style) { 'inflected' } - shared_examples :inflected_common do + shared_examples 'inflected common' do it 'registers an offense for a predicate method in actual' do expect_offense(<<-RUBY) expect(foo.empty?).to be_truthy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `be_empty` matcher over `empty?`. expect(foo.empty?).not_to be_truthy @@ -89,10 +89,14 @@ include_examples 'autocorrect', 'expect(foo.is_a?(Array)).to be_truthy', 'expect(foo).to be_a(Array)' include_examples 'autocorrect', + 'expect(foo.instance_of?(Array)).to be_truthy', + 'expect(foo).to be_an_instance_of(Array)' + + include_examples 'autocorrect', 'expect(foo.has_something?).to be_truthy', 'expect(foo).to have_something' include_examples 'autocorrect', 'expect(foo.has_something?).not_to be_truthy', 'expect(foo).not_to have_something' @@ -146,11 +150,11 @@ end context 'when strict is true' do let(:strict) { true } - include_examples :inflected_common + include_examples 'inflected common' it 'accepts strict checking boolean matcher' do expect_no_offenses(<<-RUBY) expect(foo.empty?).to eq(true) expect(foo.empty?).to be(true) @@ -162,11 +166,11 @@ end context 'when strict is false' do let(:strict) { false } - include_examples :inflected_common + include_examples 'inflected common' it 'registers an offense for a predicate method in actual' do expect_offense(<<-RUBY) expect(foo.empty?).to eq(true) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `be_empty` matcher over `empty?`. @@ -203,11 +207,11 @@ end context 'when enforced style is `explicit`' do let(:enforced_style) { 'explicit' } - shared_examples :explicit_common do + shared_examples 'explicit common' do it 'registers an offense for a predicate mather' do expect_offense(<<-RUBY) expect(foo).to be_empty ^^^^^^^^^^^^^^^^^^^^^^^ Prefer using `empty?` over `be_empty` matcher. expect(foo).not_to be_empty @@ -256,11 +260,11 @@ expect(foo).to be(true) RUBY end end - shared_examples :explicit_autocorrect do |matcher_true, matcher_false| + shared_examples 'explicit autocorrect' do |matcher_true, matcher_false| include_examples 'autocorrect', 'expect(foo).to be_something', "expect(foo.something?).to #{matcher_true}" include_examples 'autocorrect', 'expect(foo).not_to be_something', @@ -319,17 +323,17 @@ end context 'when strict is true' do let(:strict) { true } - include_examples :explicit_common - include_examples :explicit_autocorrect, 'be(true)', 'be(false)' + include_examples 'explicit common' + include_examples 'explicit autocorrect', 'be(true)', 'be(false)' end context 'when strict is false' do let(:strict) { false } - include_examples :explicit_common - include_examples :explicit_autocorrect, 'be_truthy', 'be_falsey' + include_examples 'explicit common' + include_examples 'explicit autocorrect', 'be_truthy', 'be_falsey' end end end