Skip to content

Commit

Permalink
Silence warning by removing the constant first before redefining it.
Browse files Browse the repository at this point in the history
  • Loading branch information
sikachu committed May 26, 2011
1 parent 9946837 commit 5207080
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Expand Up @@ -50,6 +50,7 @@ def self.included(example_group)
def define_class(path, base = Object, &block) def define_class(path, base = Object, &block)
namespace, class_name = *constant_path(path) namespace, class_name = *constant_path(path)
klass = Class.new(base) klass = Class.new(base)
namespace.send(:remove_const, class_name) if namespace.const_defined?(class_name)
namespace.const_set(class_name, klass) namespace.const_set(class_name, klass)
klass.class_eval(&block) if block_given? klass.class_eval(&block) if block_given?
@defined_constants << path @defined_constants << path
Expand Down

0 comments on commit 5207080

Please sign in to comment.