class Shoulda::Matchers::ActionController::RedirectToMatcher
@private
Attributes
failure_message[R]
failure_message_for_should[R]
failure_message_for_should_not[R]
failure_message_when_negated[R]
Public Class Methods
new(url_or_description, context, &block)
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 49 def initialize(url_or_description, context, &block) if block @url_block = block @location = url_or_description else @url = url_or_description @location = @url end @context = context end
Public Instance Methods
description()
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 70 def description "redirect to #{@location}" end
in_context(context)
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 60 def in_context(context) @context = context self end
matches?(controller)
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 65 def matches?(controller) @controller = controller redirects_to_url? end
Private Instance Methods
redirects_to_url?()
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 76 def redirects_to_url? begin @context.__send__(:assert_redirected_to, url) @failure_message_when_negated = "Didn't expect to redirect to #{url}" true rescue Shoulda::Matchers::AssertionError => error @failure_message = error.message false end end
url()
click to toggle source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 87 def url if @url_block @context.instance_eval(&@url_block) else @url end end