Skip to content

Commit

Permalink
Remove extra whitespace from contain failure message
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Feb 23, 2009
1 parent b4687c2 commit d96899b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/webrat/core/matchers/have_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ def matches?(stringlike)
# ==== Returns
# String:: The 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

# ==== Returns
# String:: The failure message to be displayed in negative matches.
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


def squeeze_space(inner_text)
inner_text.gsub(/^\s*$/, "").squeeze("\n")
end

def content_message
case @content
when String
Expand Down

0 comments on commit d96899b

Please sign in to comment.