class Shoulda::Matchers::ActionController::RedirectToMatcher
@private
Attributes
Public Class Methods
Source
# 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
Public Instance Methods
Source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 71 def description "redirect to #{@location.inspect}" end
Source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 61 def in_context(context) @context = context self end
Source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 66 def matches?(controller) @controller = controller redirects_to_url? end
Private Instance Methods
Source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 77 def redirects_to_url? @context.__send__(:assert_redirected_to, url) @failure_message_when_negated = "Didn't expect to redirect to #{url}" true rescue Shoulda::Matchers.assertion_exception_class => e @failure_message = e.message false end
Source
# File lib/shoulda/matchers/action_controller/redirect_to_matcher.rb, line 86 def url if @url_block @context.instance_eval(&@url_block) else @url end end