Renaming visits to visit
This commit is contained in:
parent
0addcbe430
commit
72bcbca346
|
@ -137,12 +137,12 @@ module Webrat
|
|||
# load was successful.
|
||||
#
|
||||
# Example:
|
||||
# visits "/"
|
||||
def visits(url = nil, http_method = :get, data = {})
|
||||
# visit "/"
|
||||
def visit(url = nil, http_method = :get, data = {})
|
||||
request_page(url, http_method, data)
|
||||
end
|
||||
|
||||
alias_method :visit, :visits
|
||||
alias_method :visits, :visit
|
||||
|
||||
def open_in_browser(path) # :nodoc
|
||||
`open #{path}`
|
||||
|
|
|
@ -7,11 +7,11 @@ module Webrat
|
|||
define_location_strategies
|
||||
end
|
||||
|
||||
def visits(url)
|
||||
def visit(url)
|
||||
@selenium.open(url)
|
||||
end
|
||||
|
||||
alias_method :visit, :visits
|
||||
alias_method :visits, :visit
|
||||
|
||||
def fill_in(field_identifier, options)
|
||||
locator = "webrat=#{Regexp.escape(field_identifier)}"
|
||||
|
|
|
@ -6,9 +6,9 @@ describe "Basic Auth HTTP headers" do
|
|||
@session.basic_auth('user', 'secret')
|
||||
end
|
||||
|
||||
it "should be present in visits" do
|
||||
it "should be present in visit" do
|
||||
@session.should_receive(:get).with("/", {}, {'HTTP_AUTHORIZATION' => "Basic dXNlcjpzZWNyZXQ=\n"})
|
||||
@session.visits("/")
|
||||
@session.visit("/")
|
||||
end
|
||||
|
||||
it "should be present in form submits" do
|
||||
|
|
|
@ -9,7 +9,7 @@ describe "reloads" do
|
|||
it "should reload the page with http referer" do
|
||||
@session.should_receive(:get).with("/", {})
|
||||
@session.should_receive(:get).with("/", {}, {"HTTP_REFERER"=>"/"})
|
||||
@session.visits("/")
|
||||
@session.visit("/")
|
||||
@session.reloads
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
||||
|
||||
describe "visits" do
|
||||
describe "visit" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
@session.response_body = "Hello world"
|
||||
|
@ -8,18 +8,18 @@ describe "visits" do
|
|||
|
||||
it "should use get" do
|
||||
@session.should_receive(:get).with("/", {})
|
||||
@session.visits("/")
|
||||
@session.visit("/")
|
||||
end
|
||||
|
||||
it "should assert valid response" do
|
||||
@session.response_code = 501
|
||||
lambda { @session.visits("/") }.should raise_error
|
||||
lambda { @session.visit("/") }.should raise_error
|
||||
end
|
||||
|
||||
[200, 300, 400, 499].each do |status|
|
||||
it "should consider the #{status} status code as success" do
|
||||
@session.response_code = status
|
||||
lambda { @session.visits("/") }.should_not raise_error
|
||||
lambda { @session.visit("/") }.should_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,7 +28,7 @@ describe "visits" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "visits with referer" do
|
||||
describe "visit with referer" do
|
||||
before do
|
||||
@session = Webrat::TestSession.new
|
||||
@session.instance_variable_set(:@current_url, "/old_url")
|
||||
|
@ -37,7 +37,7 @@ describe "visits with referer" do
|
|||
|
||||
it "should use get with referer header" do
|
||||
@session.should_receive(:get).with("/", {}, {"HTTP_REFERER" => "/old_url"})
|
||||
@session.visits("/")
|
||||
@session.visit("/")
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue