Class: Shoulda::ActionController::Matchers::RespondWithMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/shoulda/action_controller/matchers/respond_with_matcher.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(status) ⇒ RespondWithMatcher

Returns a new instance of RespondWithMatcher.



24
25
26
# File 'lib/shoulda/action_controller/matchers/respond_with_matcher.rb', line 24

def initialize(status)
  @status = symbol_to_status_code(status)
end

Instance Method Details

#descriptionObject



41
42
43
# File 'lib/shoulda/action_controller/matchers/respond_with_matcher.rb', line 41

def description
  "respond with #{@status}"
end

#failure_messageObject



33
34
35
# File 'lib/shoulda/action_controller/matchers/respond_with_matcher.rb', line 33

def failure_message
  "Expected #{expectation}"
end

#matches?(controller) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/shoulda/action_controller/matchers/respond_with_matcher.rb', line 28

def matches?(controller)
  @controller = controller
  correct_status_code? || correct_status_code_range?
end

#negative_failure_messageObject



37
38
39
# File 'lib/shoulda/action_controller/matchers/respond_with_matcher.rb', line 37

def negative_failure_message
  "Did not expect #{expectation}"
end