Sha256: 424d3c2dd883e4078f8d4273f7c9489c3cdd9e167a7f24401a26d5f3c6135cbc
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'cacheable_flash/test_helpers' module CacheableFlash module RspecMatchers include CacheableFlash::TestHelpers RSpec::Matchers.define :have_flash_cookie do |flash_status, expecting| define_method :has_flash_cookie? do |response| flash = testable_flash(response)[flash_status] if flash.kind_of?(Array) if expecting.kind_of?(Array) flash == expecting else matches = flash.select do |to_check| to_check == expecting end matches.length > 0 end else flash == expecting end end match{|response| has_flash_cookie?(response)} failure_message_for_should do |actual| "expected that flash cookie :#{expected[0]} #{testable_flash(actual)[expected[0]]} would include #{expected[1].inspect}" end failure_message_for_should_not do |actual| "expected that flash cookie :#{expected[0]} #{testable_flash(actual)[expected[0]]} would not include #{expected[1].inspect}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cacheable_flash-0.3.0 | lib/cacheable_flash/rspec_matchers.rb |