From 051dfe188ce652cbc2693d61705c2332ac9f1eb7 Mon Sep 17 00:00:00 2001 From: Simon Rozet Date: Wed, 24 Jun 2009 23:26:13 +0200 Subject: [PATCH] Make sure Webrat is usable without the Methods mixin --- spec/integration/rack/test/helper.rb | 5 ----- spec/integration/rack/test/webrat_rack_test.rb | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/spec/integration/rack/test/helper.rb b/spec/integration/rack/test/helper.rb index 7284dcf..e1ae2f0 100644 --- a/spec/integration/rack/test/helper.rb +++ b/spec/integration/rack/test/helper.rb @@ -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 diff --git a/spec/integration/rack/test/webrat_rack_test.rb b/spec/integration/rack/test/webrat_rack_test.rb index a2e2700..e3d760d 100644 --- a/spec/integration/rack/test/webrat_rack_test.rb +++ b/spec/integration/rack/test/webrat_rack_test.rb @@ -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