Class: Shoulda::Matchers::ActionController::RedirectToMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActionController::RedirectToMatcher
- Defined in:
- lib/shoulda/matchers/action_controller/redirect_to_matcher.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#failure_message_when_negated ⇒ Object
readonly
Returns the value of attribute failure_message_when_negated.
Instance Method Summary collapse
- #description ⇒ Object
- #in_context(context) ⇒ Object
-
#initialize(url_or_description, context, &block) ⇒ RedirectToMatcher
constructor
A new instance of RedirectToMatcher.
- #matches?(controller) ⇒ Boolean
Constructor Details
#initialize(url_or_description, context, &block) ⇒ RedirectToMatcher
Returns a new instance of RedirectToMatcher.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 46 def initialize(url_or_description, context, &block) @url_block = nil @url = nil @context = context @failure_message = nil @failure_message_when_negated = nil if block @url_block = block @location = url_or_description else @location = @url = url_or_description end end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
44 45 46 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 44 def @failure_message end |
#failure_message_when_negated ⇒ Object (readonly)
Returns the value of attribute failure_message_when_negated.
44 45 46 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 44 def @failure_message_when_negated end |
Instance Method Details
#description ⇒ Object
71 72 73 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 71 def description "redirect to #{@location.inspect}" end |
#in_context(context) ⇒ Object
61 62 63 64 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 61 def in_context(context) @context = context self end |
#matches?(controller) ⇒ Boolean
66 67 68 69 |
# File 'lib/shoulda/matchers/action_controller/redirect_to_matcher.rb', line 66 def matches?(controller) @controller = controller redirects_to_url? end |