Skip to content

Commit

Permalink
Merge commit 'gaffo/lh_123' into lh_123
Browse files Browse the repository at this point in the history
Conflicts:
	History.txt
  • Loading branch information
brynary committed Jan 17, 2009
2 parents 1731681 + f841ced commit 55bc6b8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions History.txt
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/core/matchers/have_content.rb
Expand Up @@ -55,14 +55,14 @@ def contain(content)
# 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
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/core/matchers/have_selector.rb
Expand Up @@ -38,14 +38,14 @@ def have_selector(expected, &block)
# 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
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/core/matchers/have_tag.rb
Expand Up @@ -57,14 +57,14 @@ def have_tag(name, attributes = {}, &block)
# 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
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/core/matchers/have_xpath.rb
Expand Up @@ -81,12 +81,12 @@ def have_xpath(expected, &block)

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
Expand Down
4 changes: 4 additions & 0 deletions spec/public/matchers_spec.rb
Expand Up @@ -55,6 +55,7 @@
end

describe 'asserts for xpath' do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
Expand Down Expand Up @@ -114,6 +115,7 @@
end

describe "asserts for selector," do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
Expand Down Expand Up @@ -188,6 +190,7 @@
end

describe "asserts for tags," do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
Expand Down Expand Up @@ -254,6 +257,7 @@
end

describe "asserts for contains," do
include Test::Unit::Assertions
before(:each) do
should_receive(:response_body).and_return @body
require 'test/unit'
Expand Down

0 comments on commit 55bc6b8

Please sign in to comment.