Stripping whitespace
This commit is contained in:
parent
3e71ae3733
commit
453cb4b3eb
|
@ -15,7 +15,7 @@ module Webrat
|
|||
else
|
||||
gem "nokogiri", ">= 1.0.6"
|
||||
end
|
||||
|
||||
|
||||
require "nokogiri"
|
||||
require "webrat/core/xml/nokogiri"
|
||||
end
|
||||
|
|
|
@ -287,7 +287,7 @@ For example:
|
|||
send "#{http_method}", url, data || {}, headers
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def response_location
|
||||
canonicalize_url(response.headers["Location"])
|
||||
end
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
module Webrat
|
||||
class RackTestSession < Session
|
||||
|
||||
|
||||
def initialize(rack_test_session) #:nodoc:
|
||||
super()
|
||||
@rack_test_session = rack_test_session
|
||||
end
|
||||
|
||||
|
||||
def response_body
|
||||
response.body
|
||||
end
|
||||
|
||||
|
||||
def response_code
|
||||
response.status
|
||||
end
|
||||
|
||||
|
||||
def response
|
||||
@rack_test_session.last_response
|
||||
end
|
||||
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def process_request(http_method, url, data = {}, headers = {})
|
||||
headers ||= {}
|
||||
data ||= {}
|
||||
|
||||
|
||||
env = headers.merge(:params => data, :method => http_method.to_s.upcase)
|
||||
@rack_test_session.request(url, env)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ class Test::Unit::TestCase
|
|||
include Rack::Test::Methods
|
||||
include Webrat::Methods
|
||||
include Webrat::Matchers
|
||||
|
||||
|
||||
def app
|
||||
RackApp.new
|
||||
end
|
||||
|
|
|
@ -6,12 +6,12 @@ class WebratRackTest < Test::Unit::TestCase
|
|||
response = visit "/"
|
||||
assert response.ok?
|
||||
end
|
||||
|
||||
|
||||
def test_last_response_is_available
|
||||
visit "/"
|
||||
assert last_response.ok?
|
||||
end
|
||||
|
||||
|
||||
def test_last_request_is_available
|
||||
visit "/"
|
||||
assert_equal "/", last_request.env["PATH_INFO"]
|
||||
|
@ -21,45 +21,45 @@ class WebratRackTest < Test::Unit::TestCase
|
|||
visit "/redirect_absolute_url"
|
||||
assert_equal "spam", response_body
|
||||
end
|
||||
|
||||
|
||||
def test_assertions_after_visit
|
||||
visit "/"
|
||||
assert_contain "Hello World"
|
||||
end
|
||||
|
||||
|
||||
def test_assertions_after_visit
|
||||
get "/"
|
||||
assert_contain "Hello World"
|
||||
end
|
||||
|
||||
|
||||
# def test_visits_pages
|
||||
# visit "/"
|
||||
# assert response_body.include?("visit")
|
||||
#
|
||||
#
|
||||
# click_link "there"
|
||||
# assert response_body.include?('<form method="post" action="/go">')
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def test_submits_form
|
||||
# visit "/go"
|
||||
# fill_in "Name", :with => "World"
|
||||
# fill_in "Email", :with => "world@example.org"
|
||||
# click_button "Submit"
|
||||
#
|
||||
#
|
||||
# assert response_body.include?("Hello, World")
|
||||
# assert response_body.include?("Your email is: world@example.org")
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def test_check_value_of_field
|
||||
# visit "/"
|
||||
# assert field_labeled("Prefilled").value, "text"
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def test_follows_internal_redirects
|
||||
# visit "/internal_redirect"
|
||||
# assert response_body.include?("visit")
|
||||
# end
|
||||
#
|
||||
#
|
||||
# def test_does_not_follow_external_redirects
|
||||
# visit "/external_redirect"
|
||||
# assert response_code == 302
|
||||
|
|
|
@ -101,7 +101,7 @@ describe "click_link" do
|
|||
webrat_session.should_receive(:get).with("http://www.example.com/page", {})
|
||||
click_link /_text_/
|
||||
end
|
||||
|
||||
|
||||
it "should click links by title" do
|
||||
with_html <<-HTML
|
||||
<html>
|
||||
|
@ -111,7 +111,7 @@ describe "click_link" do
|
|||
webrat_session.should_receive(:get).with("http://www.example.com/page", {})
|
||||
click_link 'piddle'
|
||||
end
|
||||
|
||||
|
||||
it "should click links by title regex" do
|
||||
with_html <<-HTML
|
||||
<html>
|
||||
|
@ -121,7 +121,7 @@ describe "click_link" do
|
|||
webrat_session.should_receive(:get).with("http://www.example.com/page", {})
|
||||
click_link /iddle/
|
||||
end
|
||||
|
||||
|
||||
|
||||
it "should click rails javascript links with authenticity tokens" do
|
||||
with_html <<-HTML
|
||||
|
|
|
@ -153,7 +153,7 @@ describe "field_labeled" do
|
|||
should_return_a Webrat::TextField, :for => "The Label"
|
||||
with_an_id_of "element_42", :for => "The Label"
|
||||
end
|
||||
|
||||
|
||||
describe "finding a field whose label ends with an non word character" do
|
||||
using_this_html <<-HTML
|
||||
<html>
|
||||
|
@ -163,7 +163,7 @@ describe "field_labeled" do
|
|||
</form>
|
||||
</html>
|
||||
HTML
|
||||
|
||||
|
||||
should_return_a Webrat::TextField, :for => "License #"
|
||||
with_an_id_of "element_42", :for => "License #"
|
||||
should_raise_error_matching /Could not find .* "Other License #"/, :for => "Other License #"
|
||||
|
|
|
@ -71,7 +71,7 @@ describe "select_date" do
|
|||
select_date "December 25, 2003"
|
||||
click_button
|
||||
end
|
||||
|
||||
|
||||
it "should work when the label ends in a non word character" do
|
||||
with_html <<-HTML
|
||||
<html>
|
||||
|
|
|
@ -231,7 +231,7 @@ describe "select" do
|
|||
}.should_not raise_error(Webrat::NotFoundError)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
it "should submit duplicates selected options as a single value" do
|
||||
with_html <<-HTML
|
||||
<html>
|
||||
|
@ -241,9 +241,9 @@ describe "select" do
|
|||
</form>
|
||||
</html>
|
||||
HTML
|
||||
|
||||
|
||||
webrat_session.should_receive(:post).with("http://www.example.com/login", "clothes" => "pants")
|
||||
click_button
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue