Skip to content

Instantly share code, notes, and snippets.

@siannopollo
Created March 3, 2010 20:39
Show Gist options
  • Save siannopollo/320985 to your computer and use it in GitHub Desktop.
Save siannopollo/320985 to your computer and use it in GitHub Desktop.
Apply styles to pages opened by Webrat (0.6.0)
Webrat::SaveAndOpenPage.module_eval do
def rewrite_css_and_image_references(response_html)
response_html.gsub(/("|')\/(stylesheets|images|javascripts)/) {"#{$1}../public/#{$2}"}
end
def saved_page_dir
File.expand_path('./tmp')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment