spec/rubocop/cop/rspec/focus_spec.rb in rubocop-rspec-1.15.1 vs spec/rubocop/cop/rspec/focus_spec.rb in rubocop-rspec-1.16.0
- old
+ new
@@ -1,11 +1,11 @@
RSpec.describe RuboCop::Cop::RSpec::Focus do
subject(:cop) { described_class.new }
# rubocop:disable RSpec/ExampleLength
it 'flags all rspec example blocks with that include `focus: true`' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
example 'test', meta: true, focus: true do; end
^^^^^^^^^^^ Focused spec found.
xit 'test', meta: true, focus: true do; end
^^^^^^^^^^^ Focused spec found.
describe 'test', meta: true, focus: true do; end
@@ -36,11 +36,11 @@
^^^^^^^^^^^ Focused spec found.
RUBY
end
it 'flags all rspec example blocks that include `:focus`' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
example_group 'test', :focus do; end
^^^^^^ Focused spec found.
feature 'test', :focus do; end
^^^^^^ Focused spec found.
xexample 'test', :focus do; end
@@ -71,11 +71,11 @@
^^^^^^ Focused spec found.
RUBY
end
it 'does not flag unfocused specs' do
- expect_no_violations(<<-RUBY)
+ expect_no_offenses(<<-RUBY)
xcontext 'test' do; end
xscenario 'test' do; end
xspecify 'test' do; end
describe 'test' do; end
example 'test' do; end
@@ -91,25 +91,25 @@
xdescribe 'test' do; end
RUBY
end
it 'does not flag a method that is focused twice' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
fit "foo", :focus do
^^^^^^^^^^^^^^^^^ Focused spec found.
end
RUBY
end
it 'ignores non-rspec code with :focus blocks' do
- expect_no_violations(<<-RUBY)
+ expect_no_offenses(<<-RUBY)
some_method "foo", focus: true do
end
RUBY
end
it 'flags focused block types' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
fdescribe 'test' do; end
^^^^^^^^^^^^^^^^ Focused spec found.
ffeature 'test' do; end
^^^^^^^^^^^^^^^ Focused spec found.
fcontext 'test' do; end