Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minor refactorings

  • Loading branch information...
commit 79cf9aaefa5e8c0a699158d7409d203534f1f3d1 1 parent f11203d
@dchelimsky dchelimsky authored
View
17 lib/rspec/mocks/argument_expectation.rb
@@ -5,7 +5,7 @@ class ArgumentExpectation
def initialize(*args, &block)
@args = args
- @matchers_block = args.empty? ? block : nil
+ @block = args.empty? ? block : nil
@match_any_args = false
@matchers = nil
@@ -26,19 +26,20 @@ def matcher_for(arg)
end
def is_matcher?(obj)
- !is_stub_as_null_object?(obj) & obj.respond_to?(:matches?) & obj.respond_to?(:description)
+ !null_object?(obj) & obj.respond_to?(:matches?) & obj.respond_to?(:description)
end
- def is_stub_as_null_object?(obj)
- obj.respond_to?(:__rspec_double_acting_as_null_object?) && obj.__rspec_double_acting_as_null_object?
+ def args_match?(*args)
+ match_any_args? || block_passes?(*args) || matchers_match?(*args)
end
- def args_match?(*args)
- match_any_args? || matchers_block_matches?(*args) || matchers_match?(*args)
+ private
+ def null_object?(obj)
+ obj.respond_to?(:__rspec_double_acting_as_null_object?) && obj.__rspec_double_acting_as_null_object?
end
- def matchers_block_matches?(*args)
- @matchers_block ? @matchers_block.call(*args) : nil
+ def block_passes?(*args)
+ @block.call(*args) if @block
end
def matchers_match?(*args)
View
4 lib/rspec/mocks/extensions/marshal.rb
@@ -1,7 +1,5 @@
module Marshal
-
class << self
-
def dump_with_mocks(*args)
object = args.shift
return dump_without_mocks(*args.unshift(object)) unless object.instance_variable_defined?(:@mock_proxy)
@@ -21,7 +19,5 @@ def dump_with_mocks(*args)
alias_method :dump_without_mocks, :dump
undef_method :dump
alias_method :dump, :dump_with_mocks
-
end
-
end
Please sign in to comment.
Something went wrong with that request. Please try again.