Skip to content

Commit

Permalink
Address ruby warning.
Browse files Browse the repository at this point in the history
warning: instance variable @constants_to_transfer not initialized
  • Loading branch information
myronmarston committed May 23, 2014
1 parent 237c306 commit 06f0876
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rspec/mocks/mutate_const.rb
Expand Up @@ -254,6 +254,11 @@ def reset
#
# @private
class DefinedConstantReplacer < BaseMutator
def initialize(*args)
super
@constants_to_transfer = []
end

def mutate
@context = recursive_const_get(@context_parts.join('::'))
@original_value = get_const_defined_on(@context, @const_name)
Expand All @@ -275,7 +280,7 @@ def to_constant
end

def reset
Array(@constants_to_transfer).each do |const|
@constants_to_transfer.each do |const|
@mutated_value.__send__(:remove_const, const)
end

Expand Down

0 comments on commit 06f0876

Please sign in to comment.