class RSpec::Hanami::MatchStatus

Constants

TYPE_CODES

Public Instance Methods

call(actual, expected) click to toggle source
# File lib/rspec/hanami/match_status.rb, line 4
def call(actual, expected)
  case expected
  when Numeric
    actual == expected
  when Symbol
    chec_symbol_status(actual, expected)
  else
    false
  end
end

Private Instance Methods

chec_symbol_status(actual, expected) click to toggle source
# File lib/rspec/hanami/match_status.rb, line 24
def chec_symbol_status(actual, expected)
  status = TYPE_CODES[expected]

  if status
    !!actual.to_s.match(status)
  else
    actual == Rack::Utils::SYMBOL_TO_STATUS_CODE[expected]
  end
end