Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: fb2f6f18d3
Fetching contributors…

Cannot retrieve contributors at this time

38 lines (32 sloc) 0.852 kB
module RSpec::Rails::Matchers
module RedirectTo
class RedirectTo < RSpec::Matchers::BuiltIn::BaseMatcher
def initialize(scope, expected)
@expected = expected
@scope = scope
end
# @api private
def matches?(_)
match_unless_raises ActiveSupport::TestCase::Assertion do
@scope.assert_redirected_to(@expected)
end
end
# @api private
def failure_message_for_should
rescued_exception.message
end
# @api private
def failure_message_for_should_not
"expected not to redirect to #{@expected.inspect}, but did"
end
end
# Delegates to `assert_redirected_to`
#
# @example
#
# response.should redirect_to(:action => "new")
def redirect_to(target)
RedirectTo.new(self, target)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.