diff options
-rw-r--r-- | guides/source/4_1_release_notes.md | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 66 |
2 files changed, 31 insertions, 37 deletions
diff --git a/guides/source/4_1_release_notes.md b/guides/source/4_1_release_notes.md index 6bd1f558b4..924e5d90db 100644 --- a/guides/source/4_1_release_notes.md +++ b/guides/source/4_1_release_notes.md @@ -498,7 +498,7 @@ for detailed changes. object. Helper methods used by multiple fixtures should be defined on modules included in `ActiveRecord::FixtureSet.context_class`. ([Pull Request](https://github.com/rails/rails/pull/13022)) -* Don't create or drop the test database if RAILS_ENV is specified explicitely. +* Don't create or drop the test database if RAILS_ENV is specified explicitly. Active Model ------------ diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index e584c01da9..195f13bdc3 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -164,55 +164,49 @@ class AppGeneratorTest < Rails::Generators::TestCase 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 + Tempfile.open('my_template') do |template| + template.puts 'gemfile_entry "tenderlove"' + template.flush + template.close + run_generator([destination_root, "-m", template.path]) + assert_file "Gemfile", /tenderlove/ + end end def test_add_skip_entry - template = Tempfile.open 'my_template' - template.puts 'add_gem_entry_filter { |gem| gem.name != "jbuilder" }' - template.flush + Tempfile.open 'my_template' do |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 + run_generator([destination_root, "-m", template.path]) + assert_file "Gemfile" do |contents| + assert_no_match 'jbuilder', contents + end end - ensure - template.close - template.unlink end def test_skip_turbolinks_when_it_is_not_on_gemfile - template = Tempfile.open 'my_template' - template.puts 'add_gem_entry_filter { |gem| gem.name != "turbolinks" }' - template.flush + Tempfile.open 'my_template' do |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 + run_generator([destination_root, "-m", template.path]) + 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 + assert_file "app/views/layouts/application.html.erb" do |contents| + assert_no_match 'turbolinks', contents + end - assert_file "app/views/layouts/application.html.erb" do |contents| - assert_no_match('data-turbolinks-track', contents) - end + assert_file "app/views/layouts/application.html.erb" do |contents| + assert_no_match('data-turbolinks-track', contents) + end - assert_file "app/assets/javascripts/application.js" do |contents| - assert_no_match 'turbolinks', contents + assert_file "app/assets/javascripts/application.js" do |contents| + assert_no_match 'turbolinks', contents + end end - ensure - template.close - template.unlink end def test_config_another_database |