spec/rubocop/cop/rspec/verified_doubles_spec.rb in rubocop-rspec-1.29.1 vs spec/rubocop/cop/rspec/verified_doubles_spec.rb in rubocop-rspec-1.30.0
- old
+ new
@@ -51,15 +51,28 @@
end
RUBY
end
end
- it 'ignores doubles without a name' do
- expect_no_offenses(<<-RUBY)
+ it 'doubles that have no name specified' do
+ expect_offense(<<-RUBY)
it do
foo = double
+ ^^^^^^ Prefer using verifying doubles over normal doubles.
end
RUBY
+ end
+
+ context 'when configured to ignore nameless doubles' do
+ let(:cop_config) { { 'IgnoreNameless' => true } }
+
+ it 'ignores doubles that have no name specified' do
+ expect_no_offenses(<<-RUBY)
+ it do
+ foo = double
+ end
+ RUBY
+ end
end
it 'ignores instance_doubles' do
expect_no_offenses(<<-RUBY)
it do