spec/rubocop/cop/rspec/described_class_spec.rb in rubocop-rspec-1.12.0 vs spec/rubocop/cop/rspec/described_class_spec.rb in rubocop-rspec-1.13.0
- old
+ new
@@ -1,6 +1,6 @@
-describe RuboCop::Cop::RSpec::DescribedClass, :config do
+RSpec.describe RuboCop::Cop::RSpec::DescribedClass, :config do
subject(:cop) { described_class.new(config) }
let(:cop_config) do
{ 'EnforcedStyle' => enforced_style }
end
@@ -13,11 +13,11 @@
bar = MyClass
end
before do
MyClass
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
Foo.custom_block do
MyClass
end
end
@@ -30,20 +30,20 @@
it 'flags violations within all blocks' do
expect_violation(<<-RUBY)
describe MyClass do
controller(ApplicationController) do
bar = MyClass
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
end
before(:each) do
MyClass
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
Foo.custom_block do
MyClass
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
end
end
end
RUBY
end
@@ -78,17 +78,17 @@
it 'checks for the use of the described class' do
expect_violation(<<-RUBY)
describe MyClass do
include MyClass
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
subject { MyClass.do_something }
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
before { MyClass.do_something }
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
end
RUBY
end
it 'ignores described class as string' do
@@ -133,11 +133,11 @@
describe MyClass do
describe MyClass::Foo do
subject { MyClass::Foo }
let(:foo) { MyClass }
- ^^^^^^^ Use `described_class` instead of `MyClass`
+ ^^^^^^^ Use `described_class` instead of `MyClass`.
end
end
RUBY
end
@@ -160,11 +160,11 @@
it 'checks for the use of described class with namespace' do
expect_violation(<<-RUBY)
describe MyNamespace::MyClass do
subject { MyNamespace::MyClass }
- ^^^^^^^^^^^^^^^^^^^^ Use `described_class` instead of `MyNamespace::MyClass`
+ ^^^^^^^^^^^^^^^^^^^^ Use `described_class` instead of `MyNamespace::MyClass`.
end
RUBY
end
it 'does not flag violations within a class scope change' do
@@ -220,16 +220,16 @@
it 'checks for the use of the described_class' do
expect_violation(<<-RUBY)
describe MyClass do
include described_class
- ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`
+ ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`.
subject { described_class.do_something }
- ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`
+ ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`.
before { described_class.do_something }
- ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`
+ ^^^^^^^^^^^^^^^ Use `MyClass` instead of `described_class`.
end
RUBY
end
it 'ignores described_class as string' do