Make sure Webrat is usable without the Methods mixin

This commit is contained in:
Simon Rozet 2009-06-24 23:26:13 +02:00
parent 042268c6a6
commit 051dfe188c
2 changed files with 18 additions and 5 deletions

View File

@ -11,11 +11,6 @@ Webrat.configure do |config|
end
class Test::Unit::TestCase
include Rack::Test::Methods
include Webrat::Methods
include Webrat::Matchers
include Webrat::HaveTagMatcher
def app
Rack::Builder.new {
use Rack::Lint

View File

@ -1,6 +1,11 @@
require File.dirname(__FILE__) + "/helper"
class WebratRackTest < Test::Unit::TestCase
include Rack::Test::Methods
include Webrat::Methods
include Webrat::Matchers
include Webrat::HaveTagMatcher
def test_visits_pages
visit "/"
click_link "there"
@ -38,3 +43,16 @@ class WebratRackTest < Test::Unit::TestCase
assert_contain "spam"
end
end
class WebratRackSetupTest < Test::Unit::TestCase
def test_usable_without_mixin
rack_test_session = Rack::Test::Session.new(app)
adapter = Webrat::RackSession.new(rack_test_session)
session = Webrat::Session.new(adapter)
session.visit "/foo"
assert_equal "spam", session.response_body
assert_equal "spam", rack_test_session.last_response.body
end
end