webrat/spec/visits_spec.rb

29 lines
778 B
Ruby
Raw Normal View History

2008-04-23 14:54:07 +00:00
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2008-03-02 20:14:52 +00:00
RAILS_ROOT = "." unless defined?(RAILS_ROOT)
2008-04-23 14:54:07 +00:00
describe "visits" do
before do
2008-03-02 20:14:52 +00:00
@session = ActionController::Integration::Session.new
@session.stubs(:assert_response)
@session.stubs(:get_via_redirect)
@response = mock
@session.stubs(:response).returns(@response)
@response.stubs(:body).returns("")
2008-03-02 20:14:52 +00:00
end
2008-04-23 14:54:07 +00:00
it "should_use_get" do
2008-03-02 20:14:52 +00:00
@session.expects(:get_via_redirect).with("/", {})
@session.visits("/")
end
2008-04-23 14:54:07 +00:00
it "should_assert_valid_response" do
2008-03-02 20:14:52 +00:00
@session.expects(:assert_response).with(:success)
@session.visits("/")
end
2008-04-23 14:54:07 +00:00
it "should_require_a_visit_before_manipulating_page" do
lambda { @session.fills_in "foo", :with => "blah" }.should raise_error
2008-03-02 20:14:52 +00:00
end
end