Remove extra whitespace from contain failure message

This commit is contained in:
Bryan Helmkamp 2009-02-23 11:19:09 -05:00
parent b4687c29d5
commit d96899be8c

View File

@ -26,15 +26,19 @@ module Webrat
# ==== Returns # ==== Returns
# String:: The failure message. # String:: The failure message.
def failure_message def failure_message
"expected the following element's content to #{content_message}:\n#{@element}" "expected the following element's content to #{content_message}:\n#{squeeze_space(@element)}"
end end
# ==== Returns # ==== Returns
# String:: The failure message to be displayed in negative matches. # String:: The failure message to be displayed in negative matches.
def negative_failure_message def negative_failure_message
"expected the following element's content to not #{content_message}:\n#{@element}" "expected the following element's content to not #{content_message}:\n#{squeeze_space(@element)}"
end end
def squeeze_space(inner_text)
inner_text.gsub(/^\s*$/, "").squeeze("\n")
end
def content_message def content_message
case @content case @content
when String when String