diff options
Diffstat (limited to 'railties/test/generators/plugin_new_generator_test.rb')
-rw-r--r-- | railties/test/generators/plugin_new_generator_test.rb | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 283d99dd9e..be72391e58 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -66,7 +66,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_no_file "test" end - def test_database_entry_is_assed_by_default_in_full_mode + def test_database_entry_is_generated_for_sqlite3_by_default_in_full_mode run_generator([destination_root, "--full"]) assert_file "test/dummy/config/database.yml", /sqlite/ assert_file "Gemfile", /^gem\s+["']sqlite3["']$/ @@ -101,19 +101,19 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase def test_skipping_javascripts_without_mountable_option run_generator - assert_no_file "app/assets/javascripts/application.js" + assert_no_file "app/assets/javascripts/bukkits/application.js" assert_no_file "vendor/assets/javascripts/jquery.js" assert_no_file "vendor/assets/javascripts/jquery_ujs.js" end def test_javascripts_generation run_generator [destination_root, "--mountable"] - assert_file "app/assets/javascripts/application.js" + assert_file "app/assets/javascripts/bukkits/application.js" end def test_jquery_is_the_default_javascript_library run_generator [destination_root, "--mountable"] - assert_file "app/assets/javascripts/application.js" do |contents| + assert_file "app/assets/javascripts/bukkits/application.js" do |contents| assert_match %r{^//= require jquery}, contents assert_match %r{^//= require jquery_ujs}, contents end @@ -124,7 +124,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase def test_other_javascript_libraries run_generator [destination_root, "--mountable", '-j', 'prototype'] - assert_file "app/assets/javascripts/application.js" do |contents| + assert_file "app/assets/javascripts/bukkits/application.js" do |contents| assert_match %r{^//= require prototype}, contents assert_match %r{^//= require prototype_ujs}, contents end @@ -135,7 +135,7 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase def test_skip_javascripts run_generator [destination_root, "--skip-javascript", "--mountable"] - assert_no_file "app/assets/javascripts/application.js" + assert_no_file "app/assets/javascripts/bukkits/application.js" assert_no_file "vendor/assets/javascripts/jquery.js" assert_no_file "vendor/assets/javascripts/jquery_ujs.js" end @@ -161,9 +161,9 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase def test_creating_engine_in_full_mode run_generator [destination_root, "--full"] - assert_file "app/assets/javascripts" - assert_file "app/assets/stylesheets" - assert_file "app/assets/images" + assert_file "app/assets/javascripts/bukkits" + assert_file "app/assets/stylesheets/bukkits" + assert_file "app/assets/images/bukkits" assert_file "app/models" assert_file "app/controllers" assert_file "app/views" @@ -180,15 +180,19 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase def test_create_mountable_application_with_mountable_option run_generator [destination_root, "--mountable"] - assert_file "app/assets/javascripts" - assert_file "app/assets/stylesheets" - assert_file "app/assets/images" + assert_file "app/assets/javascripts/bukkits" + assert_file "app/assets/stylesheets/bukkits" + assert_file "app/assets/images/bukkits" assert_file "config/routes.rb", /Bukkits::Engine.routes.draw do/ assert_file "lib/bukkits/engine.rb", /isolate_namespace Bukkits/ assert_file "test/dummy/config/routes.rb", /mount Bukkits::Engine => "\/bukkits"/ assert_file "app/controllers/bukkits/application_controller.rb", /module Bukkits\n class ApplicationController < ActionController::Base/ assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/ - assert_file "app/views/layouts/bukkits/application.html.erb", /<title>Bukkits<\/title>/ + assert_file "app/views/layouts/bukkits/application.html.erb" do |contents| + assert_match "<title>Bukkits</title>", contents + assert_match /stylesheet_link_tag\s+['"]bukkits\/application['"]/, contents + assert_match /javascript_include_tag\s+['"]bukkits\/application['"]/, contents + end end def test_creating_gemspec |