Class: Shoulda::Matchers::ActionController::RescueFromMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::RescueFromMatcher
- Defined in:
- lib/shoulda/matchers/action_controller/rescue_from_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(exception) ⇒ RescueFromMatcher
constructor
A new instance of RescueFromMatcher.
- #matches?(controller) ⇒ Boolean
- #with(method) ⇒ Object
Constructor Details
#initialize(exception) ⇒ RescueFromMatcher
Returns a new instance of RescueFromMatcher.
40 41 42 43 44 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 40 def initialize(exception) @exception = exception @expected_method = nil @controller = nil end |
Instance Method Details
#description ⇒ Object
56 57 58 59 60 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 56 def description description = "rescue from #{exception}" description << " with ##{expected_method}" if expected_method description end |
#failure_message ⇒ Object
62 63 64 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 62 def "Expected #{expectation}" end |
#failure_message_when_negated ⇒ Object
66 67 68 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 66 def "Did not expect #{expectation}" end |
#matches?(controller) ⇒ Boolean
51 52 53 54 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 51 def matches?(controller) @controller = controller rescues_from_exception? && method_name_matches? && handler_exists? end |
#with(method) ⇒ Object
46 47 48 49 |
# File 'lib/shoulda/matchers/action_controller/rescue_from_matcher.rb', line 46 def with(method) @expected_method = method self end |