Removed save_and_open_page's rewriting of static asset paths before saving (was not actually working)

This commit is contained in:
Noah Davis 2010-01-16 19:28:29 -05:00
parent 71dcfb327d
commit 1874f6d395
8 changed files with 3 additions and 62 deletions

View File

@ -4,6 +4,7 @@
* Bug fixes
* Removed save_and_open_page's rewriting of static asset paths before saving (was not actually working) (Noah Davis)
* Make "should contain" ignore extra whitespace when doing string comparisons (Noah Davis)
* Make selenium matchers handle negative match more consistently with positive match (Luke Melia)

View File

@ -11,10 +11,6 @@ module Webrat
@integration_session = session
end
def doc_root
File.expand_path(File.join(RAILS_ROOT, 'public'))
end
def get(url, data, headers = nil)
do_request(:get, url, data, headers)
end

View File

@ -11,7 +11,7 @@ module Webrat
filename = "#{Webrat.configuration.saved_pages_dir}/webrat-#{Time.now.to_i}.html"
File.open(filename, "w") do |f|
f.write rewrite_css_and_image_references(response_body)
f.write response_body
end
open_in_browser(filename)
@ -24,21 +24,5 @@ module Webrat
warn "Sorry, you need to install launchy to open pages: `gem install launchy`"
end
def rewrite_css_and_image_references(response_html) # :nodoc:
return response_html unless doc_root
response_html.gsub(/("|')\/(stylesheets|images)/, '\1' + doc_root + '/\2')
end
def doc_root #:nodoc:
nil
end
private
# accessor for testing
def ruby_platform
RUBY_PLATFORM
end
end
end

View File

@ -92,10 +92,6 @@ For example:
page
end
def doc_root #:nodoc:
nil
end
def header(key, value)
@custom_headers[key] = value
end

View File

@ -10,10 +10,6 @@ module Webrat #:nodoc:
def initialize(*args)
end
def doc_root
File.expand_path(File.join(".", "public"))
end
def response
@response ||= Object.new
end

View File

@ -2,11 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Webrat::Session do
it "should not have a doc_root" do
session = Webrat::Session.new
session.doc_root.should be_nil
end
it "should expose the current_dom" do
session = Webrat::Session.new

View File

@ -76,7 +76,4 @@ describe Webrat::RailsAdapter do
end
end
it "should provide a doc_root" do
Webrat::RailsAdapter.new(mock("integration session")).should respond_to(:doc_root)
end
end

View File

@ -33,30 +33,6 @@ describe "save_and_open_page" do
save_and_open_page
end
it "should rewrite css rules" do
@file_handle.should_receive(:write) do |html|
html.should =~ %r|"#{webrat_session.doc_root}/stylesheets/foo.css"|s
end
save_and_open_page
end
it "should rewrite image paths with double quotes" do
@file_handle.should_receive(:write) do |html|
html.should =~ %r|"#{webrat_session.doc_root}/images/bar.png"|s
end
save_and_open_page
end
it "should rewrite image paths with single quotes" do
@file_handle.should_receive(:write) do |html|
html.should =~ %r|'#{webrat_session.doc_root}/images/foo.png'|s
end
save_and_open_page
end
it "should open the temp file in a browser with Launchy" do
Launchy::Browser.should_receive(:run)
save_and_open_page