spec/rubocop/cop/rspec/expect_actual_spec.rb in rubocop-rspec-1.15.1 vs spec/rubocop/cop/rspec/expect_actual_spec.rb in rubocop-rspec-1.16.0
- old
+ new
@@ -2,11 +2,11 @@
RSpec.describe RuboCop::Cop::RSpec::ExpectActual, :config do
subject(:cop) { described_class.new(config) }
it 'flags numeric literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(123).to eq(bar)
^^^ Provide the actual you are testing to `expect(...)`.
expect(12.3).to eq(bar)
@@ -19,11 +19,11 @@
end
RUBY
end
it 'flags boolean literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(true).to eq(bar)
^^^^ Provide the actual you are testing to `expect(...)`.
expect(false).to eq(bar)
@@ -32,11 +32,11 @@
end
RUBY
end
it 'flags string and symbol literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect("foo").to eq(bar)
^^^^^ Provide the actual you are testing to `expect(...)`.
expect(:foo).to eq(bar)
@@ -45,22 +45,22 @@
end
RUBY
end
it 'flags literal nil value within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(nil).to eq(bar)
^^^ Provide the actual you are testing to `expect(...)`.
end
end
RUBY
end
it 'does not flag dynamic values within expect(...)' do
- expect_no_violations(<<-'RUBY')
+ expect_no_offenses(<<-'RUBY')
describe Foo do
it 'uses expect correctly' do
expect(foo).to eq(bar)
expect("foo#{baz}").to eq(bar)
expect(:"foo#{baz}").to eq(bar)
@@ -68,11 +68,11 @@
end
RUBY
end
it 'flags arrays containing only literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect([123]).to eq(bar)
^^^^^ Provide the actual you are testing to `expect(...)`.
expect([[123]]).to eq(bar)
@@ -81,11 +81,11 @@
end
RUBY
end
it 'flags hashes containing only literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(foo: 1, bar: 2).to eq(bar)
^^^^^^^^^^^^^^ Provide the actual you are testing to `expect(...)`.
expect(foo: 1, bar: [{}]).to eq(bar)
@@ -94,11 +94,11 @@
end
RUBY
end
it 'flags ranges containing only literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(1..2).to eq(bar)
^^^^ Provide the actual you are testing to `expect(...)`.
expect(1...2).to eq(bar)
@@ -107,21 +107,21 @@
end
RUBY
end
it 'flags regexps containing only literal values within expect(...)' do
- expect_violation(<<-RUBY)
+ expect_offense(<<-RUBY)
describe Foo do
it 'uses expect incorrectly' do
expect(/foo|bar/).to eq(bar)
^^^^^^^^^ Provide the actual you are testing to `expect(...)`.
end
end
RUBY
end
it 'does not flag complex values with dynamic parts within expect(...)' do
- expect_no_violations(<<-'RUBY')
+ expect_no_offenses(<<-'RUBY')
describe Foo do
it 'uses expect incorrectly' do
expect.to eq(bar)
expect([foo]).to eq(bar)
expect([[foo]]).to eq(bar)