Browse files

Railties: generator tests passing

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent b031198 commit 42cabeb4b89713be5b08c3116e48082c3a343bca @jeremy jeremy committed Aug 29, 2006
View
2 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]
View
0 .../missing_class/missing_class_generator.rb → .../missing_class/missing_class_generator.rb
File renamed without changes.
View
0 ...t/generators/working/working_generator.rb → ...b/generators/working/working_generator.rb
File renamed without changes.
View
32 railties/test/rails_generator_test.rb
@@ -6,20 +6,38 @@
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 @@ def test_generator_spec
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

0 comments on commit 42cabeb

Please sign in to comment.