2008-05-12 03:58:20 +00:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
|
|
|
|
|
|
RAILS_ROOT = "." unless defined?(RAILS_ROOT)
|
|
|
|
|
|
|
|
describe "visits" do
|
|
|
|
before do
|
|
|
|
@session = Webrat::TestSession.new
|
2008-05-12 04:23:37 +00:00
|
|
|
@session.response_body = "Hello world"
|
2008-05-12 03:58:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should use get" do
|
|
|
|
@session.expects(:get).with("/", {})
|
|
|
|
@session.visits("/")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should assert valid response" do
|
|
|
|
@session.response_code = 404
|
|
|
|
lambda { @session.visits("/") }.should raise_error
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should require a visit before manipulating page" do
|
|
|
|
lambda { @session.fills_in "foo", :with => "blah" }.should raise_error
|
|
|
|
end
|
|
|
|
end
|