2008-03-02 20:14:52 +00:00
|
|
|
require File.dirname(__FILE__) + "/helper"
|
|
|
|
|
2008-03-03 01:06:43 +00:00
|
|
|
RAILS_ROOT = "." unless defined?(RAILS_ROOT)
|
|
|
|
|
2008-03-02 20:14:52 +00:00
|
|
|
class VisitsTest < Test::Unit::TestCase
|
2008-03-03 01:06:43 +00:00
|
|
|
|
2008-03-02 20:14:52 +00:00
|
|
|
def setup
|
|
|
|
@session = ActionController::Integration::Session.new
|
|
|
|
@session.stubs(:assert_response)
|
|
|
|
@session.stubs(:get_via_redirect)
|
2008-03-03 01:06:43 +00:00
|
|
|
@response = mock
|
|
|
|
@session.stubs(:response).returns(@response)
|
|
|
|
@response.stubs(:body).returns("")
|
2008-03-02 20:14:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_should_use_get
|
|
|
|
@session.expects(:get_via_redirect).with("/", {})
|
|
|
|
@session.visits("/")
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_should_assert_valid_response
|
|
|
|
@session.expects(:assert_response).with(:success)
|
|
|
|
@session.visits("/")
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_should_require_a_visit_before_manipulating_page
|
|
|
|
assert_raise(RuntimeError) do
|
|
|
|
@session.fills_in "foo", :with => "blah"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|