Skip to content

Instantly share code, notes, and snippets.

module ResponseBodyHtmlWriter
def create_directory_for_html_files
@time ||= Time.now.to_s(:number)
unless @screenshots_directory
@screenshots_directory = File.expand_path(File.join(RAILS_ROOT,
'public',
'screenshots',
@time))
FileUtils.mkdir_p(@screenshots_directory)
end
module ResponseBodyHtmlWriter
def create_directory_for_html_files
@time ||= Time.now.to_s(:number)
unless @screenshots_directory
@screenshots_directory = File.expand_path(File.join(RAILS_ROOT,
'public',
'screenshots',
@time))
FileUtils.mkdir_p(@screenshots_directory)
end
module ResponseBodyHtmlWriter
def create_directory_for_html_files
@time ||= Time.now.to_s(:number)
unless @screenshots_directory
@screenshots_directory = File.expand_path(File.join(RAILS_ROOT,
'public',
'screenshots',
@time))
FileUtils.mkdir_p(@screenshots_directory)
end
module NavigationHelpers
def path_to(page_name)
case page_name
when /^the home page$/i
root_path
when /^(.*)'s profile page$/i
user_profile_path(User.find_by_login($1)
else
raise "Can't find mapping from \"#{page_name}\" to a path."
end
module NavigationHelpers
def path_to(page_name)
case page_name
when /^the home page$/i
root_path
when /^(.*)'s profile page$/i
user_profile_path(User.find_by_login($1))
else
raise "Can't find mapping from \"#{page_name}\" to a path."
end
module Foo
class Bar
include ActionController::UrlWriter
def self.some_path
puts root_path
end
end
end
module Foo
class Bar
include ActionController::UrlWriter
def self.some_path
puts root_path
end
end
end
>: ./script/console
Loading development environment (Rails 2.3.2)
>> module Foo
>> class Bar
>> include ActionController::UrlWriter
>>
?> def self.some_path
>> puts root_path
>> end
>> end
class TheRoutes < ApplicationController
def foo
render :nothing => true
end
end
module Foo
class Bar
include ActionController::UrlWriter
Loading development environment (Rails 2.3.2)
>> include ActionController::UrlWriter
=> Object
>> root_path
=> "/"
>>