Remove should_see and should_not_see
This commit is contained in:
parent
8105e5df67
commit
d6ec85839e
@ -1,27 +0,0 @@
|
||||
module Webrat
|
||||
module Assertions
|
||||
|
||||
def should_see(text_or_regexp)
|
||||
case text_or_regexp
|
||||
when Regexp
|
||||
return if scoped_html.match(text_or_regexp)
|
||||
else
|
||||
return if scoped_html.include?(text_or_regexp)
|
||||
end
|
||||
|
||||
flunk("Should see #{text_or_regexp.inspect} but didn't")
|
||||
end
|
||||
|
||||
def should_not_see(text_or_regexp)
|
||||
case text_or_regexp
|
||||
when Regexp
|
||||
return unless scoped_html.match(text_or_regexp)
|
||||
else
|
||||
return unless scoped_html.include?(text_or_regexp)
|
||||
end
|
||||
|
||||
flunk("Should not see #{text_or_regexp.inspect} but did")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,13 +1,11 @@
|
||||
require "hpricot"
|
||||
require "webrat/core/form"
|
||||
require "webrat/core/assertions"
|
||||
require "webrat/core/locators"
|
||||
|
||||
module Webrat
|
||||
class Scope
|
||||
include Logging
|
||||
include Flunk
|
||||
include Assertions
|
||||
include Locators
|
||||
|
||||
def initialize(session, html, selector = nil)
|
||||
|
@ -1,73 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||
|
||||
describe "should_not_see" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
end
|
||||
|
||||
it "should fail if the string is in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.should_not_see "Link"
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if the regexp is in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.should_not_see /Li(n)[ck]/
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if the string is in the HTML scope" do
|
||||
@session.response_body = <<-EOS
|
||||
<div id="first">
|
||||
<a href="/page2">Link</a>
|
||||
</div>
|
||||
<div id="second">
|
||||
</div>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.within "#first" do |scope|
|
||||
scope.should_not_see "Link"
|
||||
end
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
it "should pass if the string is not in the HTML scope" do
|
||||
@session.response_body = <<-EOS
|
||||
<div id="first">
|
||||
<a href="/page2">Link</a>
|
||||
</div>
|
||||
<div id="second">
|
||||
</div>
|
||||
EOS
|
||||
|
||||
@session.within "#second" do |scope|
|
||||
scope.should_not_see "Link"
|
||||
end
|
||||
end
|
||||
|
||||
it "should pass if the string is not in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
@session.should_not_see "Missing"
|
||||
end
|
||||
|
||||
it "should pass if the regexp is not in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Different</a>
|
||||
EOS
|
||||
|
||||
@session.should_not_see /Li(n)[ck]/
|
||||
end
|
||||
end
|
@ -1,73 +0,0 @@
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||
|
||||
describe "should_see" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
end
|
||||
|
||||
it "should pass if the string is in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
@session.should_see "Link"
|
||||
end
|
||||
|
||||
it "should pass if the regexp is in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
@session.should_see /Li(n)[ck]/
|
||||
end
|
||||
|
||||
it "should pass if the string is in the HTML scope" do
|
||||
@session.response_body = <<-EOS
|
||||
<div id="first">
|
||||
<a href="/page2">Link</a>
|
||||
</div>
|
||||
<div id="second">
|
||||
</div>
|
||||
EOS
|
||||
|
||||
@session.within "#first" do |scope|
|
||||
scope.should_see "Link"
|
||||
end
|
||||
end
|
||||
|
||||
it "should fail if the string is not in the HTML scope" do
|
||||
@session.response_body = <<-EOS
|
||||
<div id="first">
|
||||
<a href="/page2">Link</a>
|
||||
</div>
|
||||
<div id="second">
|
||||
</div>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.within "#second" do |scope|
|
||||
scope.should_see "Link"
|
||||
end
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if the string is not in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Link</a>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.should_see "Missing"
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
it "should fail if the regexp is not in the HTML" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page2">Different</a>
|
||||
EOS
|
||||
|
||||
lambda {
|
||||
@session.should_see /Li(n)[ck]/
|
||||
}.should raise_error
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user