spec/rubocop/cop/rspec/file_path_spec.rb in rubocop-rspec-1.2.2 vs spec/rubocop/cop/rspec/file_path_spec.rb in rubocop-rspec-1.3.0
- old
+ new
@@ -47,9 +47,19 @@
"describe MyClass, 'do_that' do; end"],
'some/class/spec.rb')
expect(cop.offenses).to be_empty
end
+ it 'ignores second argument if is not a string' do
+ inspect_source(cop,
+ 'describe MyClass, :foo do; end',
+ 'wrong_class_spec.rb')
+ expect(cop.offenses.size).to eq(1)
+ expect(cop.offenses.map(&:line).sort).to eq([1])
+ expect(cop.messages)
+ .to eq(['Spec path should end with `my_class*_spec.rb`'])
+ end
+
it 'checks class specs' do
inspect_source(cop,
'describe Some::Class do; end',
'some/class_spec.rb')
expect(cop.offenses).to be_empty