Sha256: 205e0b0da9b41120282566a5b8c6dd442c852319dc0c0e2cdf36c2e6b7589a95
Contents?: true
Size: 1.34 KB
Versions: 13
Compression:
Stored size: 1.34 KB
Contents
require 'test/unit' module Mack module TestAssertions # Takes either a Symbol or a Fixnum and assert the response matches it. # The symbols it will match are :success, :redirect, :not_found, :error. # If a Fixnum is passed it will assert the response status equals that Fixnum def assert_response(status) if status.is_a?(Symbol) case status when :success assert(responses.first.successful?) when :redirect assert(responses.first.redirect?) when :not_found assert(responses.first.not_found?) when :error assert(responses.first.server_error?) else assert(false) end elsif status.is_a?(Fixnum) assert_equal(status, responses.first.status) end end # Asserts that the request has been redirected to the specified url. def assert_redirected_to(url) assert_equal(url, responses.first.location) end # Asserts that the specified cookie has been set to the specified value. def assert_cookie(name, value) assert cookies[name.to_s] end # Asserts that there is no cookie set for the specified cookie def assert_no_cookie(name) assert !cookies[name.to_s] end end # TestAssertions end # Mack Test::Unit::TestCase.send(:include, Mack::TestAssertions)
Version data entries
13 entries across 13 versions & 1 rubygems