Skip to content

Commit

Permalink
Tweaking code to make robots happy
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshCheek committed Mar 29, 2015
1 parent 201ec34 commit 2f50d20
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/rspec/core/memoized_helpers.rb
Expand Up @@ -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
Expand All @@ -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?
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f50d20

Please sign in to comment.