Class: DuckTesting::Tester
- Inherits:
-
Object
- Object
- DuckTesting::Tester
- Defined in:
- lib/duck_testing/tester.rb
Instance Attribute Summary collapse
-
#call_data ⇒ Object
readonly
Returns the value of attribute call_data.
Instance Method Summary collapse
-
#initialize(receiver, method_name) ⇒ Tester
constructor
A new instance of Tester.
- #match?(param, expected_types) ⇒ Boolean
- #test_param(param, expected_types) ⇒ Object
- #test_return(param, expected_types) ⇒ Object
Constructor Details
#initialize(receiver, method_name) ⇒ Tester
Returns a new instance of Tester.
7 8 9 |
# File 'lib/duck_testing/tester.rb', line 7 def initialize(receiver, method_name) @call_data = MethodCallData.new(receiver, method_name) end |
Instance Attribute Details
#call_data ⇒ Object (readonly)
Returns the value of attribute call_data.
3 4 5 |
# File 'lib/duck_testing/tester.rb', line 3 def call_data @call_data end |
Instance Method Details
#match?(param, expected_types) ⇒ Boolean
28 29 30 31 32 |
# File 'lib/duck_testing/tester.rb', line 28 def match?(param, expected_types) expected_types.any? do |type| type.match?(param) end end |
#test_param(param, expected_types) ⇒ Object
13 14 15 |
# File 'lib/duck_testing/tester.rb', line 13 def test_param(param, expected_types) test(param, expected_types, :param) end |
#test_return(param, expected_types) ⇒ Object
20 21 22 23 |
# File 'lib/duck_testing/tester.rb', line 20 def test_return(param, expected_types) test(param, expected_types, :return) param end |