spec/rubocop/cop/rspec/named_subject_spec.rb in rubocop-rspec-1.15.1 vs spec/rubocop/cop/rspec/named_subject_spec.rb in rubocop-rspec-1.16.0
- old
+ new
@@ -2,11 +2,11 @@
RSpec.describe RuboCop::Cop::RSpec::NamedSubject do
subject(:cop) { described_class.new }
it 'checks `it` and `specify` for explicit subject usage' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
RSpec.describe User do
subject { described_class.new }
it "is valid" do
expect(subject.valid?).to be(true)
@@ -20,11 +20,11 @@
end
RUBY
end
it 'checks before and after for explicit subject usage' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
RSpec.describe User do
subject { described_class.new }
before(:each) do
do_something_with(subject)
@@ -38,11 +38,11 @@
end
RUBY
end
it 'checks around(:each) for explicit subject usage' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
RSpec.describe User do
subject { described_class.new }
around(:each) do |test|
do_something_with(subject)
@@ -51,10 +51,10 @@
end
RUBY
end
it 'ignores subject when not wrapped inside a test' do
- expect_no_violations(<<-RUBY)
+ expect_no_offenses(<<-RUBY)
def foo
it(subject)
end
RUBY
end