Sha256: a79290b97f6e584394076a4787b3974d9181bf43b94bad6813a9ef1b0f8aeb1d
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
module Spec module Integration module Matchers class Showing # :nodoc: def initialize(path) @expected = path end def matches?(response) @actual = response.request.request_uri actual_path, query_params_in_actual = @actual.split('?') expected_path, query_params_in_expected = @expected.split('?') if !query_params_in_expected @actual = actual_path @expected = expected_path end @actual == @expected end def failure_message "expected to be showing #{@expected} but was #{@actual}" end def negative_failure_message "expected not to be showing #{@expected}" end end # Specify that a response should be showing _path_. # # When writing integration tests, whether a ton of redirects happen or # not isn't important. You want to be sure that a particular path is # being shown. # # This will not attempt to match query parameters unless you provide # them in your path ('my/path?a=b'). Why? Because sometimes you don't # care what the query parameters are! # def be_showing(path) Showing.new(path) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems