mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 09:40:13 +01:00
Changes you will need to make: * In your environment.rb, you will need to update references to a few files per environment.rb.tmpl * In your environment.rb, you will need to specify the local time zone of the computer that is running your Tracks install. Other notes on my changes: * Modified our code to take advantage of Rails 2.1's slick time zone support. * Upgraded will_paginate for compatibility * Hacked the Selenium on Rails plugin, which has not been updated in some time and does not support Rails 2.1 * Verified that all tests pass on my machine, including Selenium tests -- I'd like confirmation from others, too.
50 lines
1.5 KiB
Ruby
50 lines
1.5 KiB
Ruby
require 'abstract_unit'
|
|
|
|
class OptionMergerTest < Test::Unit::TestCase
|
|
def setup
|
|
@options = {:hello => 'world'}
|
|
end
|
|
|
|
def test_method_with_options_merges_options_when_options_are_present
|
|
local_options = {:cool => true}
|
|
|
|
with_options(@options) do |o|
|
|
assert_equal local_options, method_with_options(local_options)
|
|
assert_equal @options.merge(local_options),
|
|
o.method_with_options(local_options)
|
|
end
|
|
end
|
|
|
|
def test_method_with_options_appends_options_when_options_are_missing
|
|
with_options(@options) do |o|
|
|
assert_equal Hash.new, method_with_options
|
|
assert_equal @options, o.method_with_options
|
|
end
|
|
end
|
|
|
|
def test_method_with_options_allows_to_overwrite_options
|
|
local_options = {:hello => 'moon'}
|
|
assert_equal @options.keys, local_options.keys
|
|
|
|
with_options(@options) do |o|
|
|
assert_equal local_options, method_with_options(local_options)
|
|
assert_equal @options.merge(local_options),
|
|
o.method_with_options(local_options)
|
|
assert_equal local_options, o.method_with_options(local_options)
|
|
end
|
|
with_options(local_options) do |o|
|
|
assert_equal local_options.merge(@options),
|
|
o.method_with_options(@options)
|
|
end
|
|
end
|
|
|
|
# Needed when counting objects with the ObjectSpace
|
|
def test_option_merger_class_method
|
|
assert_equal ActiveSupport::OptionMerger, ActiveSupport::OptionMerger.new('', '').class
|
|
end
|
|
|
|
private
|
|
def method_with_options(options = {})
|
|
options
|
|
end
|
|
end
|