Skip to content

Commit

Permalink
Change the class and method visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Jan 29, 2014
1 parent 6dce436 commit 7cf9a1c
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions activesupport/lib/active_support/testing/time_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ActiveSupport
module Testing
class SimpleStubs
class SimpleStubs # :nodoc:
Stub = Struct.new(:object, :method_name, :original_method)

def initialize
Expand Down Expand Up @@ -29,11 +29,13 @@ def unstub_all!
@stubs = {}
end

def unstub_object(stub)
stub.object.singleton_class.send :undef_method, stub.method_name
stub.object.singleton_class.send :alias_method, stub.method_name, stub.original_method
stub.object.singleton_class.send :undef_method, stub.original_method
end
private

def unstub_object(stub)
stub.object.singleton_class.send :undef_method, stub.method_name
stub.object.singleton_class.send :alias_method, stub.method_name, stub.original_method
stub.object.singleton_class.send :undef_method, stub.original_method
end
end

# Containing helpers that helps you test passage of time.
Expand Down Expand Up @@ -91,9 +93,11 @@ def travel_to(date_or_time, &block)
end
end

def simple_stubs
@simple_stubs ||= SimpleStubs.new
end
private

def simple_stubs
@simple_stubs ||= SimpleStubs.new
end
end
end
end

0 comments on commit 7cf9a1c

Please sign in to comment.