# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 98 def api_call_matcher @api_call_matcher ||= APICallMatcher.new end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 76 def block_signature(block) block.source_location.join(':') end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 61 def method_signature signature = "#{@note}\n #{super}" if @api_call_matcher && !@api_call_matcher.expected_params.empty? signature += "\n expected params to include: " + params_signature(@api_call_matcher.expected_params) end if @api_call_matcher && !@api_call_matcher.block.nil? signature += "\n expected params to match block at: " + block_signature(@api_call_matcher.block) end signature end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 72 def params_signature(hash) JSON.pretty_generate(hash).split("\n").join("\n ") end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 80 def set_note(note) @note = note end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 91 def with_action(resource, action) api_call_matcher.expected_resource = resource api_call_matcher.expected_action = action self.with(api_call_matcher) self end
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 84 def with_params(expected_params = {}, &block) api_call_matcher.expected_params = expected_params api_call_matcher.block = block if block_given? self.with(api_call_matcher) self end