Sha256: 9b4e0f1296442d85b6e08e94107ee8587447fb453d514c27c26ab2067d55229a
Contents?: true
Size: 1.23 KB
Versions: 10
Compression:
Stored size: 1.23 KB
Contents
module Shoulda module ActionController module Matchers class RespondWithMatcher def to(where) @location = case where when Symbol where == :back ? where : {:action => where.to_s} else where end self end def description description = "respond with #{@status}" description << " to #{@location.inspect}" unless @location.nil? description end def matches?(controller) @controller = controller (correct_status_code? || correct_status_code_range?) && correct_redirect_location end def expectation expectation = "response to be a #{@status}," expectation << " redirecting to #{@location.inspect}, " if @location expectation << " but was #{response_code}" expectation << " redirected to #{@controller.response.redirected_to.inspect}" if @location expectation end private def correct_redirect_location return true unless @location @controller.response.redirected_to == @location end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems