From 2f50d203c354fab480ba2aec6b0fd40a1a8146e9 Mon Sep 17 00:00:00 2001 From: Josh Cheek Date: Sat, 28 Mar 2015 23:46:52 -0600 Subject: [PATCH] Tweaking code to make robots happy --- lib/rspec/core/memoized_helpers.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/rspec/core/memoized_helpers.rb b/lib/rspec/core/memoized_helpers.rb index 376efbb090..3ff164654e 100644 --- a/lib/rspec/core/memoized_helpers.rb +++ b/lib/rspec/core/memoized_helpers.rb @@ -119,6 +119,14 @@ def is_expected expect(subject) end + # @private + # should just be placed in private section, + # but Ruby issues warnings on private attributes. + # and expanding it to the equivalent method upsets Rubocop, + # b/c it should obviously be a reader + attr_reader :__memoized + private :__memoized + private # @private @@ -127,11 +135,6 @@ def initialize(*) super end - # @private - def __memoized # raises warnings on private attributes, so have to do it this way - @__memoized - end - # @private def __init_memoized @__memoized = if RSpec.configuration.threadsafe? @@ -186,7 +189,7 @@ def self.isolate_for_context_hook(example_group_instance) # Really, this should set the old @__memoized back into place. # # Caller is the before and after context hooks - # which are both called from self.run (https://github.com/rspec/rspec-core/blob/c4dbf1bef8bb7d663c70c1acec7a5c742e41fc96/lib/rspec/core/example_group.rb#L508) + # which are both called from self.run # I didn't look at why it made tests fail, maybe an object was getting reused in RSpec tests, # if so, then that probably already works, and its the tests that are wrong. __init_memoized