From b1867c85fa934caad1cd7410e1bd9bc0463a2f42 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Fri, 21 Feb 2014 09:50:19 -0500 Subject: Revert "Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665." This reverts commit e0a521cfcd13e4d1f0ae8ab96004289e1c020f71. Conflicts: railties/CHANGELOG.md We expect loggers to quack like stdlib logger. If log4r needs different level= assignment, using a Logger-quacking wrapper is the way to do it. Fixes #14114. --- railties/test/application/configuration_test.rb | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'railties/test') diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b2d0e7e202..b39cd3747b 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -762,7 +762,7 @@ module ApplicationTests end end - test "lookup config.log_level with custom logger (stdlib Logger)" do + test "config.log_level with custom logger" do make_basic_app do |app| app.config.logger = Logger.new(STDOUT) app.config.log_level = :info @@ -770,19 +770,6 @@ module ApplicationTests assert_equal Logger::INFO, Rails.logger.level end - test "assign log_level as is with custom logger (third party logger)" do - logger_class = Class.new do - attr_accessor :level - end - logger_instance = logger_class.new - make_basic_app do |app| - app.config.logger = logger_instance - app.config.log_level = :info - end - assert_equal logger_instance, Rails.logger - assert_equal :info, Rails.logger.level - end - test "respond_to? accepts include_private" do make_basic_app -- cgit v1.2.3 From de8bef98785a78332db037b1cd6f602b2a30026d Mon Sep 17 00:00:00 2001 From: Kuldeep Aggarwal Date: Sun, 23 Feb 2014 13:10:41 +0530 Subject: Add warning when user tried to create model with pluralize name. 1. Generate model with correct_name. 2. It will help new users to avoid mistakes when tried to create model with wrong name. --- railties/test/generators/model_generator_test.rb | 7 +++++++ railties/test/generators/resource_generator_test.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 01ab77ee20..cf307d23e1 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -34,6 +34,13 @@ class ModelGeneratorTest < Rails::Generators::TestCase assert_no_migration "db/migrate/create_accounts.rb" end + def test_plural_names_are_singularized + content = run_generator ["accounts".freeze] + assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ + assert_file "test/models/account_test.rb", /class AccountTest/ + assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) + end + def test_model_with_underscored_parent_option run_generator ["account", "--parent", "admin/account"] assert_file "app/models/account.rb", /class Account < Admin::Account/ diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 3d4e694361..297cf99998 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -63,7 +63,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ assert_file "test/models/account_test.rb", /class AccountTest/ - assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural./, content) + assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) end def test_plural_names_can_be_forced -- cgit v1.2.3 From 174c9f0df39cd338a4871f82794256cc64f68a81 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 24 Feb 2014 09:43:30 +0100 Subject: include names in model generator warning message. refs #13515. This is a follow up to #13515. It includes the name given and the singularized version in the warning message. This will aide the user to see wether the detected singular was right or not. --- railties/test/generators/model_generator_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index cf307d23e1..bdf51b457c 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -38,7 +38,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ assert_file "test/models/account_test.rb", /class AccountTest/ - assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) + assert_match(/The model name 'accounts' was recognized as a plural, using the singular 'account'\. Override with --force-plural or setup custom inflection rules for this noun before running the generator\./, content) end def test_model_with_underscored_parent_option -- cgit v1.2.3 From b5c6c31dba40b0c868cd71d3d903f92ed2e50543 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 24 Feb 2014 10:09:56 +0100 Subject: build fix. follow up to 174c9f0df39cd338a4871f82794256cc64f68a81 --- railties/test/generators/resource_generator_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/generators/resource_generator_test.rb b/railties/test/generators/resource_generator_test.rb index 297cf99998..55c8d92ee8 100644 --- a/railties/test/generators/resource_generator_test.rb +++ b/railties/test/generators/resource_generator_test.rb @@ -63,7 +63,7 @@ class ResourceGeneratorTest < Rails::Generators::TestCase content = run_generator ["accounts".freeze] assert_file "app/models/account.rb", /class Account < ActiveRecord::Base/ assert_file "test/models/account_test.rb", /class AccountTest/ - assert_match(/Plural version of the model detected, using singularized version. Override with --force-plural or setup custom inflection rules for this noun before running the generator./, content) + assert_match(/The model name 'accounts' was recognized as a plural, using the singular 'account'\. Override with --force-plural or setup custom inflection rules for this noun before running the generator\./, content) end def test_plural_names_can_be_forced -- cgit v1.2.3 From ad75539a0cf55a67c0a1db1bfc76d10083c6f4ab Mon Sep 17 00:00:00 2001 From: Spencer Rogers Date: Tue, 25 Feb 2014 16:45:43 -0500 Subject: [skip ci] Fix test name typo in app generator tests. --- railties/test/generators/app_generator_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 5811379e35..3bf08b105a 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -265,7 +265,7 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_inclusion_of_plateform_dependent_gems + def test_inclusion_of_platform_dependent_gems run_generator([destination_root]) if RUBY_ENGINE == 'rbx' assert_gem 'rubysl' -- cgit v1.2.3 From 1d298bd6217d6c0feb3aa698d65289b92b11ab8d Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 25 Feb 2014 21:46:55 -0300 Subject: Remove inclusion of rubysl gem for rbx on generated Gemfile From #14026: Specific rbx-2 to limit testing on Rubinius 2.x (since there will be other versions of Rubinius > 2.x soon). Also, as of Rubinius 2.2.5, it is no longer necessary to bundle the rubysl gem. This is what Rails master/4.1 supports, so we don't need to add rubysl to gemfiles anymore. --- railties/test/generators/app_generator_test.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 3bf08b105a..5ebdadacbf 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -265,13 +265,6 @@ class AppGeneratorTest < Rails::Generators::TestCase end end - def test_inclusion_of_platform_dependent_gems - run_generator([destination_root]) - if RUBY_ENGINE == 'rbx' - assert_gem 'rubysl' - end - end - def test_jquery_is_the_default_javascript_library run_generator assert_file "app/assets/javascripts/application.js" do |contents| -- cgit v1.2.3