Merge commit 'gaffo/lh_123' into lh_123

Conflicts:
	History.txt
This commit is contained in:
Bryan Helmkamp 2009-01-17 16:27:39 -05:00
commit 55bc6b8e00
6 changed files with 13 additions and 8 deletions

View File

@ -23,6 +23,7 @@
* Minor enhancements
* Support passing an ActiveRecord model to #within when in Rails mode [#68] (Luke Melia)
* Make assert_* matchers in rails mode increment the assertions count [#123] (Amos King)
* Added assert_contain, assert_not_contain [#86] (Mike Gaffney, Amos King)
* Add configuration options for the Selenium environment and port (Kieran Pilkington)
* Maximize the browser window after initializing Selenium (Luke Melia)

View File

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

View File

@ -38,14 +38,14 @@ module Webrat
# the supplied selector
def assert_have_selector(expected)
hs = HaveSelector.new(expected)
raise Test::Unit::AssertionFailedError.new(hs.failure_message) unless hs.matches?(response_body)
assert hs.matches?(response_body), hs.failure_message
end
# Asserts that the body of the response
# does not contain the supplied string or regepx
def assert_have_no_selector(expected)
hs = HaveSelector.new(expected)
raise Test::Unit::AssertionFailedError.new(hs.negative_failure_message) if hs.matches?(response_body)
assert !hs.matches?(response_body), hs.negative_failure_message
end
end

View File

@ -57,14 +57,14 @@ module Webrat
# the supplied tag with the associated selectors
def assert_have_tag(name, attributes = {})
ht = HaveTag.new([name, attributes])
raise Test::Unit::AssertionFailedError.new(ht.failure_message) unless ht.matches?(response_body)
assert ht.matches?(response_body), ht.failure_message
end
# Asserts that the body of the response
# does not contain the supplied string or regepx
def assert_have_no_tag(name, attributes = {})
ht = HaveTag.new([name, attributes])
raise Test::Unit::AssertionFailedError.new(ht.negative_failure_message) if ht.matches?(response_body)
assert !ht.matches?(response_body), ht.negative_failure_message
end
end

View File

@ -81,12 +81,12 @@ module Webrat
def assert_have_xpath(expected, &block)
hs = HaveXpath.new(expected, &block)
raise Test::Unit::AssertionFailedError.new(hs.failure_message) unless hs.matches?(response_body)
assert hs.matches?(response_body), hs.failure_message
end
def assert_have_no_xpath(expected, &block)
hs = HaveXpath.new(expected, &block)
raise Test::Unit::AssertionFailedError.new(hs.negative_failure_message) if hs.matches?(response_body)
assert !hs.matches?(response_body), hs.negative_failure_message
end
end

View File

@ -55,6 +55,7 @@ describe Webrat::Matchers do
end
describe 'asserts for xpath' do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
@ -114,6 +115,7 @@ describe Webrat::Matchers do
end
describe "asserts for selector," do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
@ -188,6 +190,7 @@ describe Webrat::Matchers do
end
describe "asserts for tags," do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
@ -254,6 +257,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'