module HammerCLIForeman::Testing::APIExpectations

Public Instance Methods

api_expects(resource=nil, action=nil, note=nil, &block) click to toggle source
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 41
def api_expects(resource=nil, action=nil, note=nil, &block)
  ex = ApipieBindings::API.any_instance.expects(:call_action)
  ex.extend(ExpectationExtensions)
  ex.with(BlockMatcher.new(resource, action, &block))
  ex.set_note(note)
  ex
end
api_expects_no_call() click to toggle source
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 49
def api_expects_no_call
  ApipieBindings::API.any_instance.expects(:call).never
end
index_response(items) click to toggle source
# File lib/hammer_cli_foreman/testing/api_expectations.rb, line 53
def index_response(items)
  cnt = items.length
  {
    "total" => cnt,
    "subtotal" => cnt,
    "page" => 1,
    "per_page" => cnt,
    "search" => "",
    "sort" => {
      "by" => nil,
      "order" => nil
    },
    "results" => items
  }
end