From cdd390a19d5669f9103237e833f970ac2bd6d4c4 Mon Sep 17 00:00:00 2001 From: Amos King Date: Tue, 13 Jan 2009 22:14:49 -0600 Subject: [PATCH] remove commented code and make assert_contain use a true assertion --- lib/webrat/core/matchers/have_content.rb | 4 ++-- lib/webrat/selenium.rb | 1 - spec/public/matchers_spec.rb | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/webrat/core/matchers/have_content.rb b/lib/webrat/core/matchers/have_content.rb index ba0f657..8c1e3ff 100644 --- a/lib/webrat/core/matchers/have_content.rb +++ b/lib/webrat/core/matchers/have_content.rb @@ -55,14 +55,14 @@ module Webrat # the supplied string or regexp def assert_contain(content) hc = HasContent.new(content) - raise Test::Unit::AssertionFailedError.new(hc.failure_message) unless hc.matches?(response_body) + assert hc.matches?(response_body), hc.failure_message end # Asserts that the body of the response # does not contain the supplied string or regepx def assert_not_contain(content) hc = HasContent.new(content) - raise Test::Unit::AssertionFailedError.new(hc.negative_failure_message) if hc.matches?(response_body) + assert !hc.matches?(response_body), hc.negative_failure_message end end diff --git a/lib/webrat/selenium.rb b/lib/webrat/selenium.rb index 511325c..28a9485 100644 --- a/lib/webrat/selenium.rb +++ b/lib/webrat/selenium.rb @@ -88,7 +88,6 @@ module ActionController #:nodoc: IntegrationTest.class_eval do include Webrat::Methods include Webrat::Selenium::Methods -# include Webrat::Matchers include Webrat::Selenium::Matchers end end diff --git a/spec/public/matchers_spec.rb b/spec/public/matchers_spec.rb index 853d688..9883b22 100644 --- a/spec/public/matchers_spec.rb +++ b/spec/public/matchers_spec.rb @@ -254,6 +254,7 @@ describe Webrat::Matchers do end describe "asserts for contains," do + include Test::Unit::Assertions before(:each) do should_receive(:response_body).and_return @body require 'test/unit'