Class: Shoulda::Matchers::Doublespeak::MethodCall
- Inherits:
-
Object
- Object
- Shoulda::Matchers::Doublespeak::MethodCall
- Defined in:
- lib/shoulda/matchers/doublespeak/method_call.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#caller ⇒ Object
readonly
Returns the value of attribute caller.
-
#double ⇒ Object
readonly
Returns the value of attribute double.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#return_value ⇒ Object
Returns the value of attribute return_value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(args) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #inspect ⇒ Object
- #to_hash ⇒ Object
- #with_return_value(return_value) ⇒ Object
Constructor Details
#initialize(args) ⇒ MethodCall
Returns a new instance of MethodCall.
9 10 11 12 13 14 15 16 17 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 9 def initialize(args) @method_name = args.fetch(:method_name) @args = args.fetch(:args) @caller = args.fetch(:caller) @block = args[:block] @double = args[:double] @object = args[:object] @return_value = nil end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def block @block end |
#caller ⇒ Object (readonly)
Returns the value of attribute caller.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def caller @caller end |
#double ⇒ Object (readonly)
Returns the value of attribute double.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def double @double end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def method_name @method_name end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
7 8 9 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 7 def object @object end |
#return_value ⇒ Object
Returns the value of attribute return_value.
6 7 8 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 6 def return_value @return_value end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 25 def ==(other) other.is_a?(self.class) && method_name == other.method_name && args == other.args && block == other.block && double == other.double && object == other.object end |
#inspect ⇒ Object
38 39 40 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 38 def inspect "#<#{self.class.name} #{to_hash.inspect}>" end |
#to_hash ⇒ Object
34 35 36 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 34 def to_hash { method_name: method_name, args: args } end |
#with_return_value(return_value) ⇒ Object
19 20 21 22 23 |
# File 'lib/shoulda/matchers/doublespeak/method_call.rb', line 19 def with_return_value(return_value) dup.tap do |call| call.return_value = return_value end end |