aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-04-01 16:54:30 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-04-01 16:54:30 +0000
commit8f46ead1e936fc23d77a1e4d983f2ca6be1fc287 (patch)
tree68403028d2219fdb7cfc91e59c84e61d327bccaf
parent0c0c9fa863928204bd78adca1354093c60b02b72 (diff)
downloadrails-8f46ead1e936fc23d77a1e4d983f2ca6be1fc287.tar.gz
rails-8f46ead1e936fc23d77a1e4d983f2ca6be1fc287.tar.bz2
rails-8f46ead1e936fc23d77a1e4d983f2ca6be1fc287.zip
Improving railties test coverage. Closes #11496 [miloops]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9197 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/lib/rails/gem_dependency.rb2
-rw-r--r--railties/test/initializer_test.rb7
-rw-r--r--railties/test/plugin_loader_test.rb9
-rw-r--r--railties/test/rails_generator_test.rb2
-rw-r--r--railties/test/secret_key_generation_test.rb9
5 files changed, 26 insertions, 3 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index 2ffacd17b6..f9c37cb70a 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -10,7 +10,7 @@ module Rails
@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]
diff --git a/railties/test/initializer_test.rb b/railties/test/initializer_test.rb
index 3a49b2ddb4..0df0164ca6 100644
--- a/railties/test/initializer_test.rb
+++ b/railties/test/initializer_test.rb
@@ -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
diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb
index 30eeaadf12..30fcacbaa1 100644
--- a/railties/test/plugin_loader_test.rb
+++ b/railties/test/plugin_loader_test.rb
@@ -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 @@ uses_mocha "Plugin Loader Tests" do
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
diff --git a/railties/test/rails_generator_test.rb b/railties/test/rails_generator_test.rb
index 63dd501614..e1445e0a20 100644
--- a/railties/test/rails_generator_test.rb
+++ b/railties/test/rails_generator_test.rb
@@ -74,7 +74,7 @@ class RailsGeneratorTest < Test::Unit::TestCase
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
diff --git a/railties/test/secret_key_generation_test.rb b/railties/test/secret_key_generation_test.rb
index 093436889c..ea1b0dae31 100644
--- a/railties/test/secret_key_generation_test.rb
+++ b/railties/test/secret_key_generation_test.rb
@@ -9,6 +9,15 @@ end
$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'