diff options
-rw-r--r-- | actionview/test/fixtures/comments/empty.html+grid.erb | 1 | ||||
-rw-r--r-- | actionview/test/fixtures/test/_partial_with_variants.html+grid.erb | 1 | ||||
-rw-r--r-- | actionview/test/template/render_test.rb | 8 | ||||
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/i18n_railtie.rb | 4 | ||||
-rw-r--r-- | guides/bug_report_templates/action_controller_gem.rb | 2 | ||||
-rw-r--r-- | guides/bug_report_templates/active_job_gem.rb | 2 | ||||
-rw-r--r-- | guides/bug_report_templates/active_record_gem.rb | 2 | ||||
-rw-r--r-- | guides/bug_report_templates/active_record_migrations_gem.rb | 2 | ||||
-rw-r--r-- | guides/bug_report_templates/generic_gem.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/server/server_command.rb | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/test_help.rb | 7 | ||||
-rw-r--r-- | railties/test/commands/server_test.rb | 12 |
14 files changed, 39 insertions, 15 deletions
diff --git a/actionview/test/fixtures/comments/empty.html+grid.erb b/actionview/test/fixtures/comments/empty.html+grid.erb new file mode 100644 index 0000000000..dc3fa32a81 --- /dev/null +++ b/actionview/test/fixtures/comments/empty.html+grid.erb @@ -0,0 +1 @@ +<h1>No Comment</h1> diff --git a/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb b/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb new file mode 100644 index 0000000000..225363c8c3 --- /dev/null +++ b/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb @@ -0,0 +1 @@ +<h1>Partial with variants</h1> diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 412948719c..9f9882afee 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -83,6 +83,10 @@ module RenderTestCases assert_equal "<h1>Kein Kommentar</h1>", @view.render(template: "comments/empty", locale: [:de]) end + def test_render_template_with_variants + assert_equal "<h1>No Comment</h1>\n", @view.render(template: "comments/empty", variants: :grid) + end + def test_render_file_with_handlers assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: [:builder]) assert_equal "<h1>No Comment</h1>\n", @view.render(file: "comments/empty", handlers: :builder) @@ -170,6 +174,10 @@ module RenderTestCases assert_equal "partial html", @view.render(partial: "test/partial") end + def test_render_partial_with_variants + assert_equal "<h1>Partial with variants</h1>\n", @view.render(partial: "test/partial_with_variants", variants: :grid) + end + def test_render_partial_with_selected_format assert_equal "partial html", @view.render(partial: "test/partial", formats: :html) assert_equal "partial js", @view.render(partial: "test/partial", formats: [:js]) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 24ca8b0be4..5ce134d6b7 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -212,7 +212,7 @@ module ActiveRecord end def constraints - chain.map(&:scopes).flatten + chain.flat_map(&:scopes) end def counter_cache_column diff --git a/activesupport/lib/active_support/i18n_railtie.rb b/activesupport/lib/active_support/i18n_railtie.rb index b749913ee9..f05c707ccd 100644 --- a/activesupport/lib/active_support/i18n_railtie.rb +++ b/activesupport/lib/active_support/i18n_railtie.rb @@ -42,7 +42,7 @@ module I18n case setting when :railties_load_path reloadable_paths = value - app.config.i18n.load_path.unshift(*value.map(&:existent).flatten) + app.config.i18n.load_path.unshift(*value.flat_map(&:existent)) when :load_path I18n.load_path += value else @@ -58,7 +58,7 @@ module I18n directories = watched_dirs_with_extensions(reloadable_paths) reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do I18n.load_path.keep_if { |p| File.exist?(p) } - I18n.load_path |= reloadable_paths.map(&:existent).flatten + I18n.load_path |= reloadable_paths.flat_map(&:existent) I18n.reload! end diff --git a/guides/bug_report_templates/action_controller_gem.rb b/guides/bug_report_templates/action_controller_gem.rb index 46fabca3e8..1d059cc2a5 100644 --- a/guides/bug_report_templates/action_controller_gem.rb +++ b/guides/bug_report_templates/action_controller_gem.rb @@ -8,7 +8,7 @@ end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. - gem "rails", "5.1.0.rc1" + gem "rails", "5.1.0" end require "rack/test" diff --git a/guides/bug_report_templates/active_job_gem.rb b/guides/bug_report_templates/active_job_gem.rb index 71fe356ea0..252b270a0c 100644 --- a/guides/bug_report_templates/active_job_gem.rb +++ b/guides/bug_report_templates/active_job_gem.rb @@ -8,7 +8,7 @@ end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. - gem "activejob", "5.1.0.rc1" + gem "activejob", "5.1.0" end require "minitest/autorun" diff --git a/guides/bug_report_templates/active_record_gem.rb b/guides/bug_report_templates/active_record_gem.rb index a685c257ea..61d4e8d395 100644 --- a/guides/bug_report_templates/active_record_gem.rb +++ b/guides/bug_report_templates/active_record_gem.rb @@ -8,7 +8,7 @@ end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. - gem "activerecord", "5.1.0.rc1" + gem "activerecord", "5.1.0" gem "sqlite3" end diff --git a/guides/bug_report_templates/active_record_migrations_gem.rb b/guides/bug_report_templates/active_record_migrations_gem.rb index b4e822dfe0..0c398e334a 100644 --- a/guides/bug_report_templates/active_record_migrations_gem.rb +++ b/guides/bug_report_templates/active_record_migrations_gem.rb @@ -8,7 +8,7 @@ end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. - gem "activerecord", "5.1.0.rc1" + gem "activerecord", "5.1.0" gem "sqlite3" end diff --git a/guides/bug_report_templates/generic_gem.rb b/guides/bug_report_templates/generic_gem.rb index e1b705bea4..4dcd04ea27 100644 --- a/guides/bug_report_templates/generic_gem.rb +++ b/guides/bug_report_templates/generic_gem.rb @@ -8,7 +8,7 @@ end gemfile(true) do source "https://rubygems.org" # Activate the gem you are reporting the issue against. - gem "activesupport", "5.1.0.rc1" + gem "activesupport", "5.1.0" end require "active_support/core_ext/object/blank" diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb index 278fe63c51..cf3903f3ae 100644 --- a/railties/lib/rails/commands/server/server_command.rb +++ b/railties/lib/rails/commands/server/server_command.rb @@ -95,10 +95,11 @@ module Rails module Command class ServerCommand < Base # :nodoc: + DEFAULT_PORT = 3000 DEFAULT_PID_PATH = "tmp/pids/server.pid".freeze class_option :port, aliases: "-p", type: :numeric, - desc: "Runs Rails on the specified port.", banner: :port, default: 3000 + desc: "Runs Rails on the specified port - defaults to 3000.", banner: :port class_option :binding, aliases: "-b", type: :string, desc: "Binds Rails to the specified IP - defaults to 'localhost' in development and '0.0.0.0' in other environments'.", banner: :IP @@ -184,7 +185,7 @@ module Rails end def port - ENV.fetch("PORT", options[:port]).to_i + options[:port] || ENV.fetch("PORT", DEFAULT_PORT).to_i end def host diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index f4717bb35b..aa0e016424 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -317,10 +317,6 @@ module Rails def create_vendor_files build(:vendor) - - if options[:skip_yarn] - remove_file "package.json" - end end def delete_app_assets_if_api_option diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 0f9bf98737..81537d813e 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -12,7 +12,12 @@ require "rails/generators/test_case" require "active_support/testing/autorun" if defined?(ActiveRecord::Base) - ActiveRecord::Migration.maintain_test_schema! + begin + ActiveRecord::Migration.maintain_test_schema! + rescue ActiveRecord::PendingMigrationError => e + puts e.to_s.strip + exit 1 + end module ActiveSupport class TestCase diff --git a/railties/test/commands/server_test.rb b/railties/test/commands/server_test.rb index 2d1f071969..7731d10d9b 100644 --- a/railties/test/commands/server_test.rb +++ b/railties/test/commands/server_test.rb @@ -140,6 +140,18 @@ class Rails::ServerTest < ActiveSupport::TestCase end def test_argument_precedence_over_environment_variable + switch_env "PORT", "1234" do + args = ["-p", "5678"] + options = parse_arguments(args) + assert_equal 5678, options[:Port] + end + + switch_env "PORT", "1234" do + args = ["-p", "3000"] + options = parse_arguments(args) + assert_equal 3000, options[:Port] + end + switch_env "HOST", "1.2.3.4" do args = ["-b", "127.0.0.1"] options = parse_arguments(args) |