diff options
Diffstat (limited to 'railties/test/generators/app_generator_test.rb')
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 58 |
1 files changed, 53 insertions, 5 deletions
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 39d4acb7b2..e6cda07ae5 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -156,6 +156,52 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_add_gemfile_entry + template = Tempfile.open 'my_template' + template.puts 'gemfile_entry "tenderlove"' + template.flush + + run_generator([destination_root, "-m", template.path]) + assert_file "Gemfile", /tenderlove/ + ensure + template.close + template.unlink + end + + def test_add_skip_entry + template = Tempfile.open 'my_template' + template.puts 'add_gem_entry_filter { |gem| gem.name != "jbuilder" }' + template.flush + + run_generator([destination_root, "-m", template.path]) + assert_file "Gemfile" do |contents| + assert_no_match 'jbuilder', contents + end + ensure + template.close + template.unlink + end + + def test_application_html_checks_gems + template = Tempfile.open 'my_template' + template.puts 'add_gem_entry_filter { |gem| gem.name != "turbolinks" }' + template.flush + + run_generator([destination_root, "-m", template.path]) + assert_file "Gemfile" do |contents| + assert_no_match 'turbolinks', contents + end + assert_file "Gemfile" do |contents| + assert_no_match 'turbolinks', contents + end + assert_file "app/views/layouts/application.html.erb" do |contents| + assert_no_match 'turbolinks', contents + end + ensure + template.close + template.unlink + end + def test_config_another_database run_generator([destination_root, "-d", "mysql"]) assert_file "config/database.yml", /mysql/ @@ -259,6 +305,13 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_inclusion_of_plateform_dependent_gems + run_generator([destination_root]) + if RUBY_ENGINE == 'rbx' + assert_gem 'rubysl' + end + end + def test_creation_of_a_test_directory run_generator assert_file 'test' @@ -313,11 +366,6 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_inclusion_of_web_console - run_generator - assert_file "Gemfile", /gem 'web-console', \s+group: :development/ - end - def test_inclusion_of_jbuilder run_generator assert_file "Gemfile", /gem 'jbuilder'/ |