modernizes hash syntax in railties
This commit is contained in:
parent
5c315a8fa6
commit
477568ee33
|
@ -1,11 +1,11 @@
|
|||
require "rake/testtask"
|
||||
|
||||
task :default => :test
|
||||
task default: :test
|
||||
|
||||
task :package
|
||||
|
||||
desc "Run all unit tests"
|
||||
task :test => "test:isolated"
|
||||
task test: "test:isolated"
|
||||
|
||||
namespace :test do
|
||||
task :isolated do
|
||||
|
|
|
@ -5,29 +5,29 @@ module Rails
|
|||
class Task < RDoc::Task
|
||||
RDOC_FILES = {
|
||||
"activesupport" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/active_support/**/*.rb
|
||||
),
|
||||
:exclude => "lib/active_support/vendor/*"
|
||||
exclude: "lib/active_support/vendor/*"
|
||||
},
|
||||
|
||||
"activerecord" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/active_record/**/*.rb
|
||||
)
|
||||
},
|
||||
|
||||
"activemodel" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/active_model/**/*.rb
|
||||
)
|
||||
},
|
||||
|
||||
"actionpack" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/abstract_controller/**/*.rb
|
||||
lib/action_controller/**/*.rb
|
||||
|
@ -36,40 +36,40 @@ module Rails
|
|||
},
|
||||
|
||||
"actionview" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/action_view/**/*.rb
|
||||
),
|
||||
:exclude => "lib/action_view/vendor/*"
|
||||
exclude: "lib/action_view/vendor/*"
|
||||
},
|
||||
|
||||
"actionmailer" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/action_mailer/**/*.rb
|
||||
)
|
||||
},
|
||||
|
||||
"activejob" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.md
|
||||
lib/active_job/**/*.rb
|
||||
)
|
||||
},
|
||||
|
||||
"actioncable" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.md
|
||||
lib/action_cable/**/*.rb
|
||||
)
|
||||
},
|
||||
|
||||
"railties" => {
|
||||
:include => %w(
|
||||
include: %w(
|
||||
README.rdoc
|
||||
lib/**/*.rb
|
||||
),
|
||||
:exclude => "lib/rails/generators/rails/**/templates/**/*.rb"
|
||||
exclude: "lib/rails/generators/rails/**/templates/**/*.rb"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ task "load_app" do
|
|||
namespace :app do
|
||||
load APP_RAKEFILE
|
||||
end
|
||||
task :environment => "app:environment"
|
||||
task environment: "app:environment"
|
||||
|
||||
if !defined?(ENGINE_ROOT) || !ENGINE_ROOT
|
||||
ENGINE_ROOT = find_engine_path(APP_RAKEFILE)
|
||||
|
|
|
@ -21,10 +21,10 @@ namespace :test do
|
|||
# If used with Active Record, this task runs before the database schema is synchronized.
|
||||
end
|
||||
|
||||
task :run => %w[test]
|
||||
task run: %w[test]
|
||||
|
||||
desc "Run tests quickly, but also reset db"
|
||||
task :db => %w[db:test:prepare test]
|
||||
task db: %w[db:test:prepare test]
|
||||
|
||||
["models", "helpers", "controllers", "mailers", "integration", "jobs"].each do |name|
|
||||
task name => "test:prepare" do
|
||||
|
@ -33,17 +33,17 @@ namespace :test do
|
|||
end
|
||||
end
|
||||
|
||||
task :generators => "test:prepare" do
|
||||
task generators: "test:prepare" do
|
||||
$: << "test"
|
||||
Minitest.rake_run(["test/lib/generators"])
|
||||
end
|
||||
|
||||
task :units => "test:prepare" do
|
||||
task units: "test:prepare" do
|
||||
$: << "test"
|
||||
Minitest.rake_run(["test/models", "test/helpers", "test/unit"])
|
||||
end
|
||||
|
||||
task :functionals => "test:prepare" do
|
||||
task functionals: "test:prepare" do
|
||||
$: << "test"
|
||||
Minitest.rake_run(["test/controllers", "test/mailers", "test/functional"])
|
||||
end
|
||||
|
|
|
@ -233,7 +233,7 @@ fr:
|
|||
end
|
||||
|
||||
test "config.i18n.fallbacks.map = { :ca => :'es-ES' } initializes fallbacks with a mapping ca => es-ES" do
|
||||
I18n::Railtie.config.i18n.fallbacks.map = { :ca => :'es-ES' }
|
||||
I18n::Railtie.config.i18n.fallbacks.map = { ca: :'es-ES' }
|
||||
load_app
|
||||
assert_fallbacks ca: [:ca, :"es-ES", :es, :en]
|
||||
end
|
||||
|
@ -245,13 +245,13 @@ fr:
|
|||
end
|
||||
|
||||
test "[shortcut] config.i18n.fallbacks = [{ :ca => :'es-ES' }] initializes fallbacks with a mapping ca => es-ES" do
|
||||
I18n::Railtie.config.i18n.fallbacks.map = { :ca => :'es-ES' }
|
||||
I18n::Railtie.config.i18n.fallbacks.map = { ca: :'es-ES' }
|
||||
load_app
|
||||
assert_fallbacks ca: [:ca, :"es-ES", :es, :en]
|
||||
end
|
||||
|
||||
test "[shortcut] config.i18n.fallbacks = [:'en-US', { :ca => :'es-ES' }] initializes fallbacks with the given arguments" do
|
||||
I18n::Railtie.config.i18n.fallbacks = [:'en-US', { :ca => :'es-ES' }]
|
||||
I18n::Railtie.config.i18n.fallbacks = [:'en-US', { ca: :'es-ES' }]
|
||||
load_app
|
||||
assert_fallbacks ca: [:ca, :"es-ES", :es, :'en-US', :en]
|
||||
end
|
||||
|
|
|
@ -116,7 +116,7 @@ module ApplicationTests
|
|||
✓測試テスト시험
|
||||
ERB
|
||||
|
||||
get "/foo", :utf8 => "✓"
|
||||
get "/foo", utf8: "✓"
|
||||
assert_match(/boooom/, last_response.body)
|
||||
assert_match(/測試テスト시험/, last_response.body)
|
||||
end
|
||||
|
|
|
@ -448,7 +448,7 @@ module ApplicationTests
|
|||
|
||||
get "/en/foo"
|
||||
assert_equal "foo", last_response.body
|
||||
assert_equal "/en/foo", Rails.application.routes.url_helpers.foo_path(:locale => "en")
|
||||
assert_equal "/en/foo", Rails.application.routes.url_helpers.foo_path(locale: "en")
|
||||
|
||||
app_file "config/routes.rb", <<-RUBY
|
||||
Rails.application.routes.draw do
|
||||
|
@ -463,7 +463,7 @@ module ApplicationTests
|
|||
|
||||
get "/en/bar"
|
||||
assert_equal "bar", last_response.body
|
||||
assert_equal "/en/bar", Rails.application.routes.url_helpers.foo_path(:locale => "en")
|
||||
assert_equal "/en/bar", Rails.application.routes.url_helpers.foo_path(locale: "en")
|
||||
end
|
||||
|
||||
test "resource routing with irregular inflection" do
|
||||
|
|
|
@ -269,7 +269,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
|||
|
||||
def test_scaffold_with_namespace_on_revoke
|
||||
run_generator [ "admin/role", "name:string", "description:string" ]
|
||||
run_generator [ "admin/role" ], :behavior => :revoke
|
||||
run_generator [ "admin/role" ], behavior: :revoke
|
||||
|
||||
# Model
|
||||
assert_file "app/models/admin.rb" # ( should not be remove )
|
||||
|
@ -310,7 +310,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
|||
end
|
||||
File.open(route_path, "wb") { |file| file.write(content) }
|
||||
|
||||
run_generator ["product_line"], :behavior => :revoke
|
||||
run_generator ["product_line"], behavior: :revoke
|
||||
|
||||
assert_file "config/routes.rb", /\.routes\.draw do\s*\|map\|\s*$/
|
||||
end
|
||||
|
@ -328,7 +328,7 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
|
|||
File.open(route_path, "wb") { |file| file.write(content) }
|
||||
assert_file "config/routes.rb", /\.routes\.draw do\n resources :product_lines\nend\n\z/
|
||||
|
||||
run_generator ["product_line"], :behavior => :revoke
|
||||
run_generator ["product_line"], behavior: :revoke
|
||||
|
||||
assert_file "config/routes.rb", /\.routes\.draw do\nend\n\z/
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue