This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# require 'webrat_ext' | |
module Webrat | |
module Methods | |
delegate_to_session :current_path | |
end | |
class Session | |
def current_path | |
URI.parse(current_url).path | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hash | |
def intersection_equal?(other) | |
all? {|k, v| other.has_key?(k) ? other[k] == v : true } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT) | |
start_time = Time.now | |
puts "Starting CouchDB Benchmark..." | |
100000.times do |n| | |
Person.new(:first_name => "Couch_#{n}", :last_name => "Man_#{n}").save | |
end | |
puts (Time.now - start_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)} | |
require 'rubygems' unless ENV['NO_RUBYGEMS'] | |
else | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT) | |
end | |
start_time = Time.now | |
puts "Starting MongoDB Benchmark..." | |
100000.times do |n| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module AVCacheTTL | |
def self.included(base) | |
base.alias_method_chain :cache, :ttl | |
end | |
def cache_with_ttl(name = {}, options = nil, &block) | |
options = (options || {}).dup | |
return block.call if options.delete(:ignore_cache) | |
time = options.delete(:ttl) | |
time = time.from_now if time.respond_to?(:from_now) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir[File.dirname(__FILE__) + '/factories/*.rb'].each { |file| require file } | |
NewerOlder