diff --git a/lib/webrat/core/matchers/have_xpath.rb b/lib/webrat/core/matchers/have_xpath.rb index 532795eb..cc15a7a5 100644 --- a/lib/webrat/core/matchers/have_xpath.rb +++ b/lib/webrat/core/matchers/have_xpath.rb @@ -79,12 +79,12 @@ def have_xpath(expected, &block) end alias_method :match_xpath, :have_xpath - def assert_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) end - def assert_no_xpath(expected, &block) + 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) end diff --git a/spec/public/matchers_spec.rb b/spec/public/matchers_spec.rb index 26f8e03f..7a4649be 100644 --- a/spec/public/matchers_spec.rb +++ b/spec/public/matchers_spec.rb @@ -59,24 +59,24 @@ should_receive(:response_body).and_return @body require 'test/unit' end - describe "assert_xpath" do + describe "assert_have_xpath" do it "should pass when body contains the selection" do - assert_xpath("//div") + assert_have_xpath("//div") end it "should throw an exception when the body doesnt have matching xpath" do - lambda {assert_xpath("//p")}.should raise_error(Test::Unit::AssertionFailedError) + lambda {assert_have_xpath("//p")}.should raise_error(Test::Unit::AssertionFailedError) end end - describe "assert_no_xpath" do + describe "assert_have_no_xpath" do it "should pass when the body doesn't contan the xpath" do - assert_no_xpath("//p") + assert_have_no_xpath("//p") end it "should throw an exception when the body does contain the xpath" do - lambda {assert_no_xpath("//div")}.should raise_error(Test::Unit::AssertionFailedError) + lambda {assert_have_no_xpath("//div")}.should raise_error(Test::Unit::AssertionFailedError) end end end