diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-29 10:33:40 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-29 10:33:40 +0000 |
commit | 42cabeb4b89713be5b08c3116e48082c3a343bca (patch) | |
tree | 807a5e2afe10baa546abc81a13885358a79ee941 /railties | |
parent | b031198638d4ef2ba199ef4a1abb4627dcd0bad7 (diff) | |
download | rails-42cabeb4b89713be5b08c3116e48082c3a343bca.tar.gz rails-42cabeb4b89713be5b08c3116e48082c3a343bca.tar.bz2 rails-42cabeb4b89713be5b08c3116e48082c3a343bca.zip |
Railties: generator tests passing
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG | 2 | ||||
-rw-r--r-- | railties/test/fixtures/lib/generators/missing_class/missing_class_generator.rb (renamed from railties/test/generators/missing_class/missing_class_generator.rb) | 0 | ||||
-rw-r--r-- | railties/test/fixtures/lib/generators/working/working_generator.rb (renamed from railties/test/generators/working/working_generator.rb) | 0 | ||||
-rw-r--r-- | railties/test/rails_generator_test.rb | 32 |
4 files changed, 26 insertions, 8 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 7c4fcf130d..3f9068257a 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,6 +1,6 @@ *SVN* -* Cleaning up railties tests. [Kevin Clark] +* Cleaning up tests. [Kevin Clark, Jeremy Kemper] * Add Dependencies.load_once_paths. [Nicholas Seckar] diff --git a/railties/test/generators/missing_class/missing_class_generator.rb b/railties/test/fixtures/lib/generators/missing_class/missing_class_generator.rb index e69de29bb2..e69de29bb2 100644 --- a/railties/test/generators/missing_class/missing_class_generator.rb +++ b/railties/test/fixtures/lib/generators/missing_class/missing_class_generator.rb diff --git a/railties/test/generators/working/working_generator.rb b/railties/test/fixtures/lib/generators/working/working_generator.rb index 465b34319a..465b34319a 100644 --- a/railties/test/generators/working/working_generator.rb +++ b/railties/test/fixtures/lib/generators/working/working_generator.rb diff --git a/railties/test/rails_generator_test.rb b/railties/test/rails_generator_test.rb index 89824efbd6..9167ba2dd4 100644 --- a/railties/test/rails_generator_test.rb +++ b/railties/test/rails_generator_test.rb @@ -6,20 +6,38 @@ begin rescue LoadError end +# Mock out what we need from AR::Base. +module ActiveRecord + class Base + class << self + attr_accessor :pluralize_table_names + end + self.pluralize_table_names = true + end +end + +# And what we need from ActionView +module ActionView + module Helpers + module ActiveRecordHelper; end + class InstanceTag; end + end +end + + # Must set before requiring generator libs. -RAILS_ROOT = File.dirname(__FILE__) +RAILS_ROOT = "#{File.dirname(__FILE__)}/fixtures" + +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" +require 'rails_generator' -# Preemptively load the rest of Rails so Gems don't hijack our requires. -require File.dirname(__FILE__) + '/../../activerecord/lib/active_record' -require File.dirname(__FILE__) + '/../../actionpack/lib/action_controller' -require File.dirname(__FILE__) + '/../lib/rails_generator' class RailsGeneratorTest < Test::Unit::TestCase BUILTINS = %w(controller mailer model scaffold) CAPITALIZED_BUILTINS = BUILTINS.map { |b| b.capitalize } def test_sources - expected = [:app, :user, :RubyGems, :builtin] + expected = [:lib, :vendor, :plugins, :user, :RubyGems, :builtin] expected.delete(:gem) unless Object.const_defined?(:Gem) assert_equal expected, Rails::Generator::Base.sources.map { |s| s.label } end @@ -69,7 +87,7 @@ class RailsGeneratorTest < Test::Unit::TestCase spec = Rails::Generator::Base.lookup('working') assert_equal 'working', spec.name assert_equal "#{RAILS_ROOT}/lib/generators/working", spec.path - assert_equal :app, spec.source + assert_equal :lib, spec.source assert_nothing_raised { assert_match /WorkingGenerator$/, spec.klass.name } end |