aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-05-31 21:41:47 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2015-06-02 09:11:48 +0900
commit36127934751d61e08d0858db97e7a35aa6417f79 (patch)
treed9c939066c8782123ddf1ecd04ce9c00a2278e85 /railties
parentc861ef283fb94576a4025e4eb8d62808034ab2ee (diff)
downloadrails-36127934751d61e08d0858db97e7a35aa6417f79.tar.gz
rails-36127934751d61e08d0858db97e7a35aa6417f79.tar.bz2
rails-36127934751d61e08d0858db97e7a35aa6417f79.zip
add test to run generated test files inside mountable engine
Diffstat (limited to 'railties')
-rw-r--r--railties/test/generators/plugin_generator_test.rb16
-rw-r--r--railties/test/generators/scaffold_controller_generator_test.rb11
-rw-r--r--railties/test/generators/scaffold_generator_test.rb14
3 files changed, 25 insertions, 16 deletions
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb
index 57da8ab268..d6e5f4bd89 100644
--- a/railties/test/generators/plugin_generator_test.rb
+++ b/railties/test/generators/plugin_generator_test.rb
@@ -508,22 +508,6 @@ class PluginGeneratorTest < Rails::Generators::TestCase
assert_match(/namespace :admin/, contents)
assert_no_match(/namespace :bukkit/, contents)
end
- assert_file "test/controllers/bukkits/admin/dashboard_controller_test.rb" do |contents|
- assert_match(/@routes = Engine.routes/, contents)
- end
- end
-
- def test_generating_scaffold_controller_inside_mountable_engine
- run_generator [destination_root, "--mountable"]
-
- capture(:stdout) do
- `#{destination_root}/bin/rails g scaffold User name:string age:integer`
- end
-
- assert_file "test/controllers/bukkits/users_controller_test.rb" do |contents|
- assert_match(/@user = bukkits_users\(:one\)/, contents)
- assert_match(/@routes = Engine.routes/, contents)
- end
end
def test_git_name_and_email_in_gemspec_file
diff --git a/railties/test/generators/scaffold_controller_generator_test.rb b/railties/test/generators/scaffold_controller_generator_test.rb
index 34e752cea1..7c282377d7 100644
--- a/railties/test/generators/scaffold_controller_generator_test.rb
+++ b/railties/test/generators/scaffold_controller_generator_test.rb
@@ -174,4 +174,15 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
end
end
end
+
+ def test_controller_tests_pass_by_default_inside_mountable_engine
+ Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --mountable` }
+
+ engine_path = File.join(destination_root, "bukkits")
+
+ Dir.chdir(engine_path) do
+ quietly { `bin/rails g controller dashboard foo` }
+ assert_match(/2 runs, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test 2>&1`)
+ end
+ end
end
diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb
index ee06802874..8f43747b9e 100644
--- a/railties/test/generators/scaffold_generator_test.rb
+++ b/railties/test/generators/scaffold_generator_test.rb
@@ -393,4 +393,18 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
assert_match(/password_digest: <%= BCrypt::Password.create\('secret'\) %>/, content)
end
end
+
+ def test_scaffold_tests_pass_by_default_inside_mountable_engine
+ Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --mountable` }
+
+ engine_path = File.join(destination_root, "bukkits")
+
+ Dir.chdir(engine_path) do
+ quietly do
+ `bin/rails g scaffold User name:string age:integer;
+ bundle exec rake db:migrate`
+ end
+ assert_match(/8 runs, 13 assertions, 0 failures, 0 errors/, `bundle exec rake test 2>&1`)
+ end
+ end
end