From 0e0339e943911a3673079a1349ae299305ebe4dd Mon Sep 17 00:00:00 2001 From: Fujimura Daisuke Date: Fri, 16 Dec 2011 18:00:02 +0900 Subject: [PATCH] Add flash type to expectation and description --- .../matchers/action_controller/set_the_flash_matcher.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb b/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb index 9e60054d..adc81481 100644 --- a/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb +++ b/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb @@ -42,7 +42,7 @@ module Shoulda # :nodoc: attr_reader :failure_message, :negative_failure_message def description - description = "set the flash" + description = "set the #{expected_flash_invocation}" description << " to #{@value.inspect}" unless @value.nil? description end @@ -88,7 +88,7 @@ module Shoulda # :nodoc: end def expectation - expectation = "the flash#{".now" if @now}#{":[%s]" % @key if @key} to be set" + expectation = "the #{expected_flash_invocation} to be set" expectation << " to #{@value.inspect}" unless @value.nil? expectation << ", but #{flash_description}" expectation @@ -102,8 +102,13 @@ module Shoulda # :nodoc: end end + def expected_flash_invocation + "flash#{".now" if @now}#{"[:%s]" % @key if @key}" + end + end + end end end