From ff00ae10ea45d895c843196009fed0a3c631c072 Mon Sep 17 00:00:00 2001 From: Amos King Date: Mon, 5 Jan 2009 12:59:56 -0600 Subject: [PATCH] add have to assert_selector and assert_no_selector for consistency. --- lib/webrat/core/matchers/have_selector.rb | 4 ++-- spec/public/matchers_spec.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/webrat/core/matchers/have_selector.rb b/lib/webrat/core/matchers/have_selector.rb index 8052901..b6278bd 100644 --- a/lib/webrat/core/matchers/have_selector.rb +++ b/lib/webrat/core/matchers/have_selector.rb @@ -36,14 +36,14 @@ module Webrat # Asserts that the body of the response contains # the supplied selector - def assert_selector(expected) + def assert_have_selector(expected) hs = HaveSelector.new(expected) raise Test::Unit::AssertionFailedError.new(hs.failure_message) unless hs.matches?(response_body) end # Asserts that the body of the response # does not contain the supplied string or regepx - def assert_no_selector(expected) + def assert_have_no_selector(expected) hs = HaveSelector.new(expected) 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 7a4649b..58b173d 100644 --- a/spec/public/matchers_spec.rb +++ b/spec/public/matchers_spec.rb @@ -118,24 +118,24 @@ describe Webrat::Matchers do should_receive(:response_body).and_return @body require 'test/unit' end - describe "assert_selector" do + describe "assert_have_selector" do it "should pass when body contains the selection" do - assert_selector("div") + assert_have_selector("div") end it "should throw an exception when the body doesnt have matching selection" do - lambda {assert_selector("p")}.should raise_error(Test::Unit::AssertionFailedError) + lambda {assert_have_selector("p")}.should raise_error(Test::Unit::AssertionFailedError) end end - describe "assert_not_selector" do + describe "assert_have_not_selector" do it "should pass when the body doesn't contan the selection" do - assert_no_selector("p") + assert_have_no_selector("p") end it "should throw an exception when the body does contain the selection" do - lambda {assert_no_selector("div")}.should raise_error(Test::Unit::AssertionFailedError) + lambda {assert_have_no_selector("div")}.should raise_error(Test::Unit::AssertionFailedError) end end end