Skip to content

Commit

Permalink
Wrap RAILS_ROOT to support Merb also
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwyn Morfey committed Apr 17, 2008
1 parent ede0073 commit 2e03051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/webrat.rb
Expand Up @@ -4,6 +4,9 @@

module Webrat
VERSION = '0.2.1'
def self.root
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
end
end

if defined?(Merb)
Expand Down
4 changes: 2 additions & 2 deletions lib/webrat/page.rb
Expand Up @@ -94,10 +94,10 @@ def selects(option_text, options = {})
# Example:
# save_and_open
def save_and_open
return unless File.exist?(RAILS_ROOT + "/tmp")
return unless File.exist?(Webrat.root + "/tmp")

filename = "webrat-#{Time.now.to_i}.html"
File.open(RAILS_ROOT + "/tmp/#{filename}", "w") do |f|
File.open(Webrat.root + "/tmp/#{filename}", "w") do |f|
f.write response.body
end
`open tmp/#{filename}`
Expand Down

0 comments on commit 2e03051

Please sign in to comment.