Class: Rspec::Bash::Util::CallLogArgumentListMatcher
- Inherits:
-
ArgumentListMatcher
- Object
- ArgumentListMatcher
- Rspec::Bash::Util::CallLogArgumentListMatcher
- Defined in:
- lib/rspec/bash/util/call_log_argument_list_matcher.rb
Instance Method Summary collapse
- #args_match?(actual_call_log_list) ⇒ Boolean
- #get_call_count(actual_call_log_list) ⇒ Object
- #get_call_log_matches(actual_call_log_list) ⇒ Object
-
#initialize(expected_args = [any_args]) ⇒ CallLogArgumentListMatcher
constructor
A new instance of CallLogArgumentListMatcher.
- #parent_args_match? ⇒ Object
- #parent_initialize ⇒ Object
Constructor Details
#initialize(expected_args = [any_args]) ⇒ CallLogArgumentListMatcher
Returns a new instance of CallLogArgumentListMatcher.
12 13 14 15 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 12 def initialize(expected_args = [any_args]) expected_args = expected_args.empty? ? [any_args] : expected_args parent_initialize(*expected_args) end |
Instance Method Details
#args_match?(actual_call_log_list) ⇒ Boolean
17 18 19 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 17 def args_match?(actual_call_log_list) get_call_count(actual_call_log_list) > 0 end |
#get_call_count(actual_call_log_list) ⇒ Object
21 22 23 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 21 def get_call_count(actual_call_log_list) get_call_log_matches(actual_call_log_list).size end |
#get_call_log_matches(actual_call_log_list) ⇒ Object
25 26 27 28 29 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 25 def get_call_log_matches(actual_call_log_list) actual_call_log_list.select do |actual_call_list| parent_args_match?(*actual_call_list[:args]) end end |
#parent_args_match? ⇒ Object
9 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 9 alias parent_args_match? args_match? |
#parent_initialize ⇒ Object
10 |
# File 'lib/rspec/bash/util/call_log_argument_list_matcher.rb', line 10 alias parent_initialize initialize |