Skip to content

Commit

Permalink
Moved two definitions to the correct module name since RSpec changed …
Browse files Browse the repository at this point in the history
…the name of the module. Updated object#track_methods method to track all public methods if no arguments were passed in.
  • Loading branch information
Michael Brennan committed Jun 29, 2009
1 parent 820c456 commit 0a5ceac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/not_a_mock/argument_constraint_extensions.rb
Expand Up @@ -2,13 +2,6 @@

module Spec #:nodoc:
module Mocks #:nodoc:

class AnyArgConstraint #:nodoc:
def inspect
'anything'
end
end

class AnyOrderArgConstraint #:nodoc:
def initialize(array)
@array = array
Expand All @@ -23,11 +16,17 @@ def inspect
end
end

module ArgumentConstraintMatchers #:nodoc:
module ArgumentMatchers #:nodoc:
class AnyArgMatcher #:nodoc:
def inspect
'anything'
end
end

def in_any_order(array)
Spec::Mocks::AnyOrderArgConstraint.new(array)
end
end

end
end
4 changes: 4 additions & 0 deletions lib/not_a_mock/object_extensions.rb
Expand Up @@ -6,6 +6,10 @@ class Object
# See NotAMock::Matchers for info on how to test which methods have been
# called, with what arguments, etc.
def track_methods(*methods)
if methods.empty?
self.public_methods(false).map {|method_name| methods << method_name.to_s.to_sym}
end

methods.each do |method|
NotAMock::CallRecorder.instance.track_method(self, method)
end
Expand Down

0 comments on commit 0a5ceac

Please sign in to comment.