aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/generators
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-06-09 00:01:00 -0700
committerJosé Valim <jose.valim@gmail.com>2011-06-09 00:01:00 -0700
commiteb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a (patch)
tree714871363eaaba2123ceebc12e94b307aea6148c /railties/test/generators
parentaf3f0b6204dd81b4df50dbc567276bf5c8264ebe (diff)
parent331d58fb04821546b1e622290432a2dd13e52301 (diff)
downloadrails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.tar.gz
rails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.tar.bz2
rails-eb8c0a7b1a4ecad676e4d0733bbf91b88fb01e2a.zip
Merge pull request #1356 from flippingbits/fix_engine_generator
Fix engine's generator
Diffstat (limited to 'railties/test/generators')
-rw-r--r--railties/test/generators/namespaced_generators_test.rb10
-rw-r--r--railties/test/generators/plugin_new_generator_test.rb13
-rw-r--r--railties/test/generators/shared_generator_tests.rb4
3 files changed, 13 insertions, 14 deletions
diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb
index 17cbac0912..dd1e4bdac1 100644
--- a/railties/test/generators/namespaced_generators_test.rb
+++ b/railties/test/generators/namespaced_generators_test.rb
@@ -7,15 +7,7 @@ require 'rails/generators/rails/scaffold/scaffold_generator'
class NamespacedGeneratorTestCase < Rails::Generators::TestCase
def setup
- TestApp::Application.isolate_namespace(TestApp)
- end
-
- def teardown
- if TestApp.respond_to?(:_railtie)
- TestApp.singleton_class.send(:undef_method, :_railtie)
- TestApp.singleton_class.send(:undef_method, :table_name_prefix)
- TestApp::Application.isolated = false
- end
+ Rails::Generators.namespace = TestApp
end
end
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb
index b272638026..283d99dd9e 100644
--- a/railties/test/generators/plugin_new_generator_test.rb
+++ b/railties/test/generators/plugin_new_generator_test.rb
@@ -12,7 +12,6 @@ DEFAULT_PLUGIN_FILES = %w(
lib
lib/bukkits.rb
lib/tasks/bukkits_tasks.rake
- script/rails
test/bukkits_test.rb
test/test_helper.rb
test/dummy
@@ -172,6 +171,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_file "config/routes.rb", /Rails.application.routes.draw do/
assert_file "lib/bukkits/engine.rb", /module Bukkits\n class Engine < ::Rails::Engine\n end\nend/
assert_file "lib/bukkits.rb", /require "bukkits\/engine"/
+ assert_file "script/rails"
end
def test_being_quiet_while_creating_dummy_application
@@ -199,8 +199,16 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_file "bukkits.gemspec", /s.version = "0.0.1"/
end
+ def test_usage_of_engine_commands
+ run_generator [destination_root, "--full"]
+ assert_file "script/rails", /ENGINE_PATH = File.expand_path\('..\/..\/lib\/bukkits\/engine', __FILE__\)/
+ assert_file "script/rails", /ENGINE_ROOT = File.expand_path\('..\/..', __FILE__\)/
+ assert_file "script/rails", /require 'rails\/all'/
+ assert_file "script/rails", /require 'rails\/engine\/commands'/
+ end
+
def test_shebang
- run_generator
+ run_generator [destination_root, "--full"]
assert_file "script/rails", /#!\/usr\/bin\/env ruby/
end
@@ -254,7 +262,6 @@ class CustomPluginGeneratorTest < Rails::Generators::TestCase
assert_file 'spec/dummy'
assert_file 'Rakefile', /task :default => :spec/
assert_file 'Rakefile', /# spec tasks in rakefile/
- assert_file 'script/rails', %r{spec/dummy}
end
protected
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index be9aef8a41..d3074afd91 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -67,12 +67,12 @@ module SharedGeneratorTests
end
def test_shebang_is_added_to_rails_file
- run_generator [destination_root, "--ruby", "foo/bar/baz"]
+ run_generator [destination_root, "--ruby", "foo/bar/baz", "--full"]
assert_file "script/rails", /#!foo\/bar\/baz/
end
def test_shebang_when_is_the_same_as_default_use_env
- run_generator [destination_root, "--ruby", Thor::Util.ruby_command]
+ run_generator [destination_root, "--ruby", Thor::Util.ruby_command, "--full"]
assert_file "script/rails", /#!\/usr\/bin\/env/
end