Make sure Webrat is usable without the Methods mixin
This commit is contained in:
parent
042268c6a6
commit
051dfe188c
|
@ -11,11 +11,6 @@ Webrat.configure do |config|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Test::Unit::TestCase
|
class Test::Unit::TestCase
|
||||||
include Rack::Test::Methods
|
|
||||||
include Webrat::Methods
|
|
||||||
include Webrat::Matchers
|
|
||||||
include Webrat::HaveTagMatcher
|
|
||||||
|
|
||||||
def app
|
def app
|
||||||
Rack::Builder.new {
|
Rack::Builder.new {
|
||||||
use Rack::Lint
|
use Rack::Lint
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
require File.dirname(__FILE__) + "/helper"
|
require File.dirname(__FILE__) + "/helper"
|
||||||
|
|
||||||
class WebratRackTest < Test::Unit::TestCase
|
class WebratRackTest < Test::Unit::TestCase
|
||||||
|
include Rack::Test::Methods
|
||||||
|
include Webrat::Methods
|
||||||
|
include Webrat::Matchers
|
||||||
|
include Webrat::HaveTagMatcher
|
||||||
|
|
||||||
def test_visits_pages
|
def test_visits_pages
|
||||||
visit "/"
|
visit "/"
|
||||||
click_link "there"
|
click_link "there"
|
||||||
|
@ -38,3 +43,16 @@ class WebratRackTest < Test::Unit::TestCase
|
||||||
assert_contain "spam"
|
assert_contain "spam"
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue