Removed save_and_open_page's rewriting of static asset paths before saving (was not actually working)
This commit is contained in:
parent
71dcfb327d
commit
1874f6d395
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
* Bug fixes
|
* 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 "should contain" ignore extra whitespace when doing string comparisons (Noah Davis)
|
||||||
* Make selenium matchers handle negative match more consistently with positive match (Luke Melia)
|
* Make selenium matchers handle negative match more consistently with positive match (Luke Melia)
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,6 @@ module Webrat
|
||||||
@integration_session = session
|
@integration_session = session
|
||||||
end
|
end
|
||||||
|
|
||||||
def doc_root
|
|
||||||
File.expand_path(File.join(RAILS_ROOT, 'public'))
|
|
||||||
end
|
|
||||||
|
|
||||||
def get(url, data, headers = nil)
|
def get(url, data, headers = nil)
|
||||||
do_request(:get, url, data, headers)
|
do_request(:get, url, data, headers)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ module Webrat
|
||||||
filename = "#{Webrat.configuration.saved_pages_dir}/webrat-#{Time.now.to_i}.html"
|
filename = "#{Webrat.configuration.saved_pages_dir}/webrat-#{Time.now.to_i}.html"
|
||||||
|
|
||||||
File.open(filename, "w") do |f|
|
File.open(filename, "w") do |f|
|
||||||
f.write rewrite_css_and_image_references(response_body)
|
f.write response_body
|
||||||
end
|
end
|
||||||
|
|
||||||
open_in_browser(filename)
|
open_in_browser(filename)
|
||||||
|
@ -24,21 +24,5 @@ module Webrat
|
||||||
warn "Sorry, you need to install launchy to open pages: `gem install launchy`"
|
warn "Sorry, you need to install launchy to open pages: `gem install launchy`"
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -92,10 +92,6 @@ For example:
|
||||||
page
|
page
|
||||||
end
|
end
|
||||||
|
|
||||||
def doc_root #:nodoc:
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def header(key, value)
|
def header(key, value)
|
||||||
@custom_headers[key] = value
|
@custom_headers[key] = value
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,10 +10,6 @@ module Webrat #:nodoc:
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def doc_root
|
|
||||||
File.expand_path(File.join(".", "public"))
|
|
||||||
end
|
|
||||||
|
|
||||||
def response
|
def response
|
||||||
@response ||= Object.new
|
@response ||= Object.new
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,11 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
||||||
|
|
||||||
describe Webrat::Session do
|
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
|
it "should expose the current_dom" do
|
||||||
session = Webrat::Session.new
|
session = Webrat::Session.new
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,4 @@ describe Webrat::RailsAdapter do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should provide a doc_root" do
|
|
||||||
Webrat::RailsAdapter.new(mock("integration session")).should respond_to(:doc_root)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,30 +33,6 @@ describe "save_and_open_page" do
|
||||||
save_and_open_page
|
save_and_open_page
|
||||||
end
|
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
|
it "should open the temp file in a browser with Launchy" do
|
||||||
Launchy::Browser.should_receive(:run)
|
Launchy::Browser.should_receive(:run)
|
||||||
save_and_open_page
|
save_and_open_page
|
||||||
|
|
Loading…
Reference in New Issue