mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-22 02:00:12 +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.
40 lines
1.4 KiB
Ruby
40 lines
1.4 KiB
Ruby
require 'plugin_test_helper'
|
|
|
|
class GeneratorLookupTest < Test::Unit::TestCase
|
|
def setup
|
|
@fixture_dirs = %w{alternate default}
|
|
@configuration = Rails.configuration = Rails::Configuration.new
|
|
# We need to add our testing plugin directory to the plugin paths so
|
|
# the locator knows where to look for our plugins
|
|
@configuration.plugin_paths += @fixture_dirs.map{|fd| plugin_fixture_path(fd)}
|
|
@initializer = Rails::Initializer.new(@configuration)
|
|
@initializer.add_plugin_load_paths
|
|
@initializer.load_plugins
|
|
load 'rails_generator.rb'
|
|
require 'rails_generator/scripts'
|
|
end
|
|
|
|
def test_should_load_from_all_plugin_paths
|
|
assert Rails::Generator::Base.lookup('a_generator')
|
|
assert Rails::Generator::Base.lookup('stubby_generator')
|
|
end
|
|
|
|
def test_should_create_generator_source_for_each_directory_in_plugin_paths
|
|
sources = Rails::Generator::Base.sources
|
|
@fixture_dirs.each do |gen_dir|
|
|
expected_label = "plugins (fixtures/plugins/#{gen_dir})".to_sym
|
|
assert sources.any? {|source| source.label == expected_label }
|
|
end
|
|
end
|
|
|
|
def test_should_preserve_order_in_usage_message
|
|
msg = Rails::Generator::Scripts::Base.new.send(:usage_message)
|
|
positions = @fixture_dirs.map do |gen_dir|
|
|
pos = msg.index("Plugins (fixtures/plugins/#{gen_dir})")
|
|
assert_not_nil pos
|
|
pos
|
|
end
|
|
assert_equal positions.sort, positions
|
|
end
|
|
|
|
end
|