1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Add flash type to expectation and description

This commit is contained in:
Fujimura Daisuke 2011-12-16 18:00:02 +09:00 committed by Gabe Berke-Williams
parent ef866e2674
commit 0e0339e943

View file

@ -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