Added missing quote from rewrite_css_and_image_references and added support for single quotes
This commit is contained in:
parent
78a23abb6e
commit
b75ff6221b
@ -21,6 +21,10 @@
|
|||||||
* Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
|
* Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
|
||||||
* Deprecated current_page lh50 (Mike Gaffney)
|
* Deprecated current_page lh50 (Mike Gaffney)
|
||||||
|
|
||||||
|
* Bug fixes
|
||||||
|
|
||||||
|
* Translate CSS and image paths with single quotes in save_and_open_page (Erin Staniland)
|
||||||
|
|
||||||
== 0.4.4 / 2009-04-06
|
== 0.4.4 / 2009-04-06
|
||||||
|
|
||||||
* Major enhancements
|
* Major enhancements
|
||||||
|
@ -28,7 +28,7 @@ module Webrat
|
|||||||
|
|
||||||
def rewrite_css_and_image_references(response_html) # :nodoc:
|
def rewrite_css_and_image_references(response_html) # :nodoc:
|
||||||
return response_html unless doc_root
|
return response_html unless doc_root
|
||||||
response_html.gsub(/"\/(stylesheets|images)/, doc_root + '/\1')
|
response_html.gsub(/("|')\/(stylesheets|images)/, '\1' + doc_root + '/\2')
|
||||||
end
|
end
|
||||||
|
|
||||||
def saved_page_dir #:nodoc:
|
def saved_page_dir #:nodoc:
|
||||||
|
@ -10,6 +10,7 @@ describe "save_and_open_page" do
|
|||||||
<body>
|
<body>
|
||||||
<h1>Hello world</h1>
|
<h1>Hello world</h1>
|
||||||
<img src="/images/bar.png" />
|
<img src="/images/bar.png" />
|
||||||
|
<img src='/images/foo.png' />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
HTML
|
HTML
|
||||||
@ -25,15 +26,23 @@ describe "save_and_open_page" do
|
|||||||
|
|
||||||
it "should rewrite css rules" do
|
it "should rewrite css rules" do
|
||||||
@file_handle.should_receive(:write) do |html|
|
@file_handle.should_receive(:write) do |html|
|
||||||
html.should =~ %r|#{webrat_session.doc_root}/stylesheets/foo.css|s
|
html.should =~ %r|"#{webrat_session.doc_root}/stylesheets/foo.css"|s
|
||||||
end
|
end
|
||||||
|
|
||||||
save_and_open_page
|
save_and_open_page
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should rewrite image paths" do
|
it "should rewrite image paths with double quotes" do
|
||||||
@file_handle.should_receive(:write) do |html|
|
@file_handle.should_receive(:write) do |html|
|
||||||
html.should =~ %r|#{webrat_session.doc_root}/images/bar.png|s
|
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
|
end
|
||||||
|
|
||||||
save_and_open_page
|
save_and_open_page
|
||||||
|
Loading…
Reference in New Issue
Block a user