Wrap RAILS_ROOT to support Merb also
This commit is contained in:
parent
ede0073db4
commit
2e03051735
@ -4,6 +4,9 @@ end
|
||||
|
||||
module Webrat
|
||||
VERSION = '0.2.1'
|
||||
def self.root
|
||||
defined?(RAILS_ROOT) ? RAILS_ROOT : Merb.root
|
||||
end
|
||||
end
|
||||
|
||||
if defined?(Merb)
|
||||
|
@ -94,10 +94,10 @@ module Webrat
|
||||
# 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}`
|
||||
|
Loading…
Reference in New Issue
Block a user