Class: RSpecApi::Matchers::Status::Matcher

Inherits:
Response::Matcher show all
Defined in:
lib/rspec-api/matchers/status/matcher.rb

Instance Attribute Summary collapse

Attributes inherited from Response::Matcher

#response

Instance Method Summary collapse

Methods inherited from Response::Matcher

#failure_message_for_should, #failure_message_for_should_not

Constructor Details

#initialize(status_symbol_or_code) ⇒ Matcher

Returns a new instance of Matcher.



10
11
12
# 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

Instance Attribute Details

#status_symbol_or_codeObject

Returns the value of attribute status_symbol_or_code.



8
9
10
# File 'lib/rspec-api/matchers/status/matcher.rb', line 8

def status_symbol_or_code
  @status_symbol_or_code
end

Instance Method Details

#descriptionObject



18
19
20
# File 'lib/rspec-api/matchers/status/matcher.rb', line 18

def description
  "be #{status_code}"
end

#matches?(response) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rspec-api/matchers/status/matcher.rb', line 14

def matches?(response)
  super && status == status_code
end