Skip to content

Commit

Permalink
fix tests on ruby 2
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Jul 22, 2013
1 parent 452c7f8 commit ccb8171
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/const_mocker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def remove
end

def declare
@parent.const_set @const_name, Class.new unless @parent.const_defined?(@const_name)
@parent.const_set @const_name, Class.new
end

def restore
Expand All @@ -20,11 +20,11 @@ def restore
end

def const
@parent.const_get @const_name
@parent.const_get @const_name if @parent.const_defined?(@const_name)
end

def self.mock(*const_names, &block)
cm = new(*const_names)
def self.mock(const_name, parent = Object, &block)
cm = new(const_name, parent)
yield(cm)
cm.restore
true
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'simplecov'
SimpleCov.start
SimpleCov.start { add_filter 'test' }

ENV['RAILS_ENV'] = 'test'
require "mock_app/config/environment"
Expand Down

0 comments on commit ccb8171

Please sign in to comment.