spec/rubocop/cop/rspec/cop_spec.rb in rubocop-rspec-1.15.1 vs spec/rubocop/cop/rspec/cop_spec.rb in rubocop-rspec-1.16.0
- old
+ new
@@ -36,50 +36,50 @@
let(:rspec_patterns) { ['_spec.rb$', '(?:^|/)spec/'] }
context 'when the source path ends with `_spec.rb`' do
it 'registers an offense' do
- expect_violation(<<-RUBY, filename: 'foo_spec.rb')
+ expect_offense(<<-RUBY, 'foo_spec.rb')
foo(1)
^^^^^^ I flag everything
RUBY
end
it 'ignores the file if it is ignored' do
- expect_no_violations(<<-RUBY, filename: 'bar_spec.rb')
+ expect_no_offenses(<<-RUBY, 'bar_spec.rb')
foo(1)
RUBY
end
end
context 'when the source path contains `/spec/`' do
it 'registers an offense' do
- expect_violation(<<-RUBY, filename: '/spec/support/thing.rb')
+ expect_offense(<<-RUBY, '/spec/support/thing.rb')
foo(1)
^^^^^^ I flag everything
RUBY
end
end
context 'when the source path starts with `spec/`' do
it 'registers an offense' do
- expect_violation(<<-RUBY, filename: 'spec/support/thing.rb')
+ expect_offense(<<-RUBY, 'spec/support/thing.rb')
foo(1)
^^^^^^ I flag everything
RUBY
end
end
context 'when the file is a source file without "spec" in the name' do
it 'ignores the source when the path is not a spec file' do
- expect_no_violations(<<-RUBY, filename: 'foo.rb')
+ expect_no_offenses(<<-RUBY, 'foo.rb')
foo(1)
RUBY
end
it 'ignores the source when the path is not a specified pattern' do
- expect_no_violations(<<-RUBY, filename: 'foo_test.rb')
+ expect_no_offenses(<<-RUBY, 'foo_test.rb')
foo(1)
RUBY
end
end
@@ -87,10 +87,10 @@
let(:rspec_patterns) do
['_test\.rb$']
end
it 'registers offenses when the path matches a custom specified pattern' do
- expect_violation(<<-RUBY, filename: 'foo_test.rb')
+ expect_offense(<<-RUBY, 'foo_test.rb')
foo(1)
^^^^^^ I flag everything
RUBY
end
end