diff options
Diffstat (limited to 'railties')
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 |