class RSpecApi::Matchers::Status::Matcher

Attributes

status_symbol_or_code[RW]

Public Class Methods

new(status_symbol_or_code) click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 10
def initialize(status_symbol_or_code)
  @status_symbol_or_code = status_symbol_or_code
end

Public Instance Methods

description() click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 18
def description
  "be #{status_code}"
end
matches?(response) click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 14
def matches?(response)
  super && status == status_code
end

Private Instance Methods

actual() click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 36
def actual
  status
end
match() click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 40
def match
  'status code'
end
status_code() click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 24
def status_code
  to_code status_symbol_or_code
end
to_code(symbol_or_code) click to toggle source
# File lib/rspec-api/matchers/status/matcher.rb, line 28
def to_code(symbol_or_code)
  if symbol_or_code.is_a? Symbol
    Rack::Utils.status_code symbol_or_code
  else
    symbol_or_code
  end
end