Improving railties test coverage. Closes #11496 [miloops]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9197 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2008-04-01 16:54:30 +00:00
parent 0c0c9fa863
commit 8f46ead1e9
5 changed files with 26 additions and 3 deletions

@ -10,7 +10,7 @@ def initialize(name, options = {})
@name = name.to_s
if options[:version]
@requirement = Gem::Requirement.create(options[:version])
@version = @requirement.requirements.first.last
@version = @requirement.instance_variable_get("@requirements").first.last
end
@lib = options[:lib]
@source = options[:source]

@ -1,6 +1,13 @@
require 'abstract_unit'
require 'initializer'
# Mocks out the configuration
module Rails
def self.configuration
Rails::Configuration.new
end
end
class ConfigurationMock < Rails::Configuration
attr_reader :environment_path

@ -1,5 +1,12 @@
require 'plugin_test_helper'
# Mocks out the configuration
module Rails
def self.configuration
Rails::Configuration.new
end
end
uses_mocha "Plugin Loader Tests" do
class TestPluginLoader < Test::Unit::TestCase
@ -41,7 +48,7 @@ def test_should_return_empty_array_if_configuration_plugins_is_empty
end
def test_should_find_all_availble_plugins_and_return_as_all_plugins
assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.all_plugins, @failure_tip
assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.all_plugins.reverse, @failure_tip
end
def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_untouched

@ -74,7 +74,7 @@ def test_autolookup
def test_lookup_missing_generator
assert_raise Rails::Generator::GeneratorError do
Rails::Generator::Base.lookup('missing_generator').klass
Rails::Generator::Base.lookup('missing').klass
end
end

@ -9,6 +9,15 @@
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'initializer'
# Mocks out the configuration
module Rails
def self.configuration
Rails::Configuration.new
end
end
require 'rails_generator'
require 'rails_generator/secret_key_generator'
require 'rails_generator/generators/applications/app/app_generator'