diff --git a/lib/rubocop/cop/rspec/leaky_constant_declaration.rb b/lib/rubocop/cop/rspec/leaky_constant_declaration.rb index b39e61332..155aef735 100644 --- a/lib/rubocop/cop/rspec/leaky_constant_declaration.rb +++ b/lib/rubocop/cop/rspec/leaky_constant_declaration.rb @@ -47,10 +47,12 @@ module RSpec # end # # # good - anonymous class, no constant needs to be defined - # let(:foo_class) do - # Class.new(described_class) do - # def double_that - # some_base_method * 2 + # describe SomeClass do + # let(:foo_class) do + # Class.new(described_class) do + # def double_that + # some_base_method * 2 + # end # end # end # diff --git a/manual/cops_rspec.md b/manual/cops_rspec.md index e2b15a6c1..c90fb48d2 100644 --- a/manual/cops_rspec.md +++ b/manual/cops_rspec.md @@ -1530,10 +1530,12 @@ describe SomeClass do end # good - anonymous class, no constant needs to be defined -let(:foo_class) do - Class.new(described_class) do - def double_that - some_base_method * 2 +describe SomeClass do + let(:foo_class) do + Class.new(described_class) do + def double_that + some_base_method * 2 + end end end