diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-10-14 09:57:41 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-10-14 09:57:41 -0700 |
commit | 6338e1e68dfbe77c39eaaa17bb4950ef7db73704 (patch) | |
tree | 6bca387ebcc859a5f277a65f268cd885c7e1b00c /railties/test/application | |
parent | 1974911b8d5780ec16e138027a0099bd8482f88f (diff) | |
parent | 5ad7f8ab418f0c760dbb584f7c78d94ce32e9ee3 (diff) | |
download | rails-6338e1e68dfbe77c39eaaa17bb4950ef7db73704.tar.gz rails-6338e1e68dfbe77c39eaaa17bb4950ef7db73704.tar.bz2 rails-6338e1e68dfbe77c39eaaa17bb4950ef7db73704.zip |
Merge pull request #7941 from robin850/master
Use 1.9 Hash syntax in railties
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/asset_debugging_test.rb | 4 | ||||
-rw-r--r-- | railties/test/application/assets_test.rb | 6 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 30 | ||||
-rw-r--r-- | railties/test/application/generators_test.rb | 30 | ||||
-rw-r--r-- | railties/test/application/initializers/i18n_test.rb | 14 | ||||
-rw-r--r-- | railties/test/application/initializers/notifications_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/loading_test.rb | 28 | ||||
-rw-r--r-- | railties/test/application/middleware/cache_test.rb | 24 | ||||
-rw-r--r-- | railties/test/application/middleware/session_test.rb | 2 | ||||
-rw-r--r-- | railties/test/application/middleware_test.rb | 8 | ||||
-rw-r--r-- | railties/test/application/rake_test.rb | 10 | ||||
-rw-r--r-- | railties/test/application/routing_test.rb | 28 | ||||
-rw-r--r-- | railties/test/application/url_generation_test.rb | 6 |
13 files changed, 96 insertions, 96 deletions
diff --git a/railties/test/application/asset_debugging_test.rb b/railties/test/application/asset_debugging_test.rb index a7b3ae1e9a..1eddfac664 100644 --- a/railties/test/application/asset_debugging_test.rb +++ b/railties/test/application/asset_debugging_test.rb @@ -7,7 +7,7 @@ module ApplicationTests include Rack::Test::Methods def setup - build_app(:initializers => true) + build_app(initializers: true) app_file "app/assets/javascripts/application.js", "//= require_tree ." app_file "app/assets/javascripts/xmlhr.js", "function f1() { alert(); }" @@ -15,7 +15,7 @@ module ApplicationTests app_file "config/routes.rb", <<-RUBY AppTemplate::Application.routes.draw do - get '/posts', :to => "posts#index" + get '/posts', to: "posts#index" end RUBY diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 8a76b2f614..2506d19e6d 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -8,7 +8,7 @@ module ApplicationTests include Rack::Test::Methods def setup - build_app(:initializers => true) + build_app(initializers: true) boot_rails end @@ -44,7 +44,7 @@ module ApplicationTests app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get '*path', :to => lambda { |env| [200, { "Content-Type" => "text/html" }, "Not an asset"] } + get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, "Not an asset"] } end RUBY @@ -353,7 +353,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index flash[:cool_story] = true - render :text => "ok" + render text: "ok" end end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 3691c5e3d5..7a120410ba 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -239,7 +239,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index cookies.signed[:some_key] = "some_value" - render :text => env["action_dispatch.secret_token"] + render text: env["action_dispatch.secret_token"] end end @@ -252,7 +252,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= csrf_meta_tags %>" + render inline: "<%= csrf_meta_tags %>" end end @@ -272,11 +272,11 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ApplicationController def show - render :inline => "<%= begin; form_for(Post.new) {}; rescue => e; e.to_s; end %>" + render inline: "<%= begin; form_for(Post.new) {}; rescue => e; e.to_s; end %>" end def update - render :text => "update" + render text: "update" end end RUBY @@ -291,7 +291,7 @@ module ApplicationTests token = "cf50faa3fe97702ca1ae" PostsController.any_instance.stubs(:form_authenticity_token).returns(token) - params = {:authenticity_token => token} + params = {authenticity_token: token} get "/posts/1" assert_match(/patch/, last_response.body) @@ -316,7 +316,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= csrf_meta_tags %>" + render inline: "<%= csrf_meta_tags %>" end end @@ -440,7 +440,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= image_path('foo.jpg') %>" + render inline: "<%= image_path('foo.jpg') %>" end end @@ -493,7 +493,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :text => env["action_dispatch.show_exceptions"] + render text: env["action_dispatch.show_exceptions"] end end @@ -503,7 +503,7 @@ module ApplicationTests test "config.action_controller.wrap_parameters is set in ActionController::Base" do app_file 'config/initializers/wrap_parameters.rb', <<-RUBY - ActionController::Base.wrap_parameters :format => [:json] + ActionController::Base.wrap_parameters format: [:json] RUBY app_file 'app/models/post.rb', <<-RUBY @@ -523,7 +523,7 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ApplicationController def create - render :text => params[:post].inspect + render text: params[:post].inspect end end RUBY @@ -544,7 +544,7 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ActionController::Base def create - render :text => params[:post].permitted? ? "permitted" : "forbidden" + render text: params[:post].permitted? ? "permitted" : "forbidden" end end RUBY @@ -558,7 +558,7 @@ module ApplicationTests require "#{app_path}/config/environment" - post "/posts", {:post => {"title" =>"zomg"}} + post "/posts", {post: {"title" =>"zomg"}} assert_equal 'permitted', last_response.body end @@ -570,8 +570,8 @@ module ApplicationTests class ::OmgController < ActionController::Base def index respond_to do |format| - format.html { render :text => "HTML" } - format.xml { render :text => "XML" } + format.html { render text: "HTML" } + format.xml { render text: "XML" } end end end @@ -579,7 +579,7 @@ module ApplicationTests get "/", {}, "HTTP_ACCEPT" => "application/xml" assert_equal 'HTML', last_response.body - get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml" + get "/", { format: :xml }, "HTTP_ACCEPT" => "application/xml" assert_equal 'XML', last_response.body end diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb index b80244f1d2..bc0af499c1 100644 --- a/railties/test/application/generators_test.rb +++ b/railties/test/application/generators_test.rb @@ -48,22 +48,22 @@ module ApplicationTests c.generators.orm = :data_mapper c.generators.test_framework = :rspec c.generators.helper = false - expected = { :rails => { :orm => :data_mapper, :test_framework => :rspec, :helper => false } } + expected = { rails: { orm: :data_mapper, test_framework: :rspec, helper: false } } assert_equal(expected, c.generators.options) end end test "generators set rails aliases" do with_config do |c| - c.generators.aliases = { :rails => { :test_framework => "-w" } } - expected = { :rails => { :test_framework => "-w" } } + c.generators.aliases = { rails: { test_framework: "-w" } } + expected = { rails: { test_framework: "-w" } } assert_equal expected, c.generators.aliases end end test "generators aliases, options, templates and fallbacks on initialization" do add_to_config <<-RUBY - config.generators.rails :aliases => { :test_framework => "-w" } + config.generators.rails aliases: { test_framework: "-w" } config.generators.orm :data_mapper config.generators.test_framework :rspec config.generators.fallbacks[:shoulda] = :test_unit @@ -76,7 +76,7 @@ module ApplicationTests assert_equal :rspec, Rails::Generators.options[:rails][:test_framework] assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework] - assert_equal Hash[:shoulda => :test_unit], Rails::Generators.fallbacks + assert_equal Hash[shoulda: :test_unit], Rails::Generators.fallbacks assert_equal ["some/where"], Rails::Generators.templates_path end @@ -95,31 +95,31 @@ module ApplicationTests test "generators with hashes for options and aliases" do with_bare_config do |c| c.generators do |g| - g.orm :data_mapper, :migration => false - g.plugin :aliases => { :generator => "-g" }, - :generator => true + g.orm :data_mapper, migration: false + g.plugin aliases: { generator: "-g" }, + generator: true end expected = { - :rails => { :orm => :data_mapper }, - :plugin => { :generator => true }, - :data_mapper => { :migration => false } + rails: { orm: :data_mapper }, + plugin: { generator: true }, + data_mapper: { migration: false } } assert_equal expected, c.generators.options - assert_equal({ :plugin => { :generator => "-g" } }, c.generators.aliases) + assert_equal({ plugin: { generator: "-g" } }, c.generators.aliases) end end test "generators with string and hash for options should generate symbol keys" do with_bare_config do |c| c.generators do |g| - g.orm 'data_mapper', :migration => false + g.orm 'data_mapper', migration: false end expected = { - :rails => { :orm => :data_mapper }, - :data_mapper => { :migration => false } + rails: { orm: :data_mapper }, + data_mapper: { migration: false } } assert_equal expected, c.generators.options diff --git a/railties/test/application/initializers/i18n_test.rb b/railties/test/application/initializers/i18n_test.rb index 02d20bc150..489b7ddb92 100644 --- a/railties/test/application/initializers/i18n_test.rb +++ b/railties/test/application/initializers/i18n_test.rb @@ -143,7 +143,7 @@ en: I18n::Railtie.config.i18n.fallbacks = true load_app assert I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks) - assert_fallbacks :de => [:de, :en] + assert_fallbacks de: [:de, :en] end test "config.i18n.fallbacks = true initializes I18n.fallbacks with default settings even when backend changes" do @@ -151,37 +151,37 @@ en: I18n::Railtie.config.i18n.backend = Class.new(I18n::Backend::Simple).new load_app assert I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks) - assert_fallbacks :de => [:de, :en] + assert_fallbacks de: [:de, :en] end test "config.i18n.fallbacks.defaults = [:'en-US'] initializes fallbacks with en-US as a fallback default" do I18n::Railtie.config.i18n.fallbacks.defaults = [:'en-US'] load_app - assert_fallbacks :de => [:de, :'en-US', :en] + assert_fallbacks de: [:de, :'en-US', :en] 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' } load_app - assert_fallbacks :ca => [:ca, :"es-ES", :es, :en] + assert_fallbacks ca: [:ca, :"es-ES", :es, :en] end test "[shortcut] config.i18n.fallbacks = [:'en-US'] initializes fallbacks with en-US as a fallback default" do I18n::Railtie.config.i18n.fallbacks = [:'en-US'] load_app - assert_fallbacks :de => [:de, :'en-US', :en] + assert_fallbacks de: [:de, :'en-US', :en] end test "[shortcut] config.i18n.fallbacks = [{ :ca => :'es-ES' }] initializes fallbacks with a mapping de-AT => de-DE" do I18n::Railtie.config.i18n.fallbacks.map = { :ca => :'es-ES' } load_app - assert_fallbacks :ca => [:ca, :"es-ES", :es, :en] + 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' }] load_app - assert_fallbacks :ca => [:ca, :"es-ES", :es, :'en-US', :en] + assert_fallbacks ca: [:ca, :"es-ES", :es, :'en-US', :en] end end end diff --git a/railties/test/application/initializers/notifications_test.rb b/railties/test/application/initializers/notifications_test.rb index d866a63fe0..baae6fd928 100644 --- a/railties/test/application/initializers/notifications_test.rb +++ b/railties/test/application/initializers/notifications_test.rb @@ -33,7 +33,7 @@ module ApplicationTests ActiveRecord::Base.logger = logger # Mimic Active Record notifications - instrument "sql.active_record", :name => "SQL", :sql => "SHOW tables" + instrument "sql.active_record", name: "SQL", sql: "SHOW tables" wait assert_equal 1, logger.logged(:debug).size diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb index fcbc3c048c..ad7172c514 100644 --- a/railties/test/application/loading_test.rb +++ b/railties/test/application/loading_test.rb @@ -19,14 +19,14 @@ class LoadingTest < ActiveSupport::TestCase test "constants in app are autoloaded" do app_file "app/models/post.rb", <<-MODEL class Post < ActiveRecord::Base - validates_acceptance_of :title, :accept => "omg" + validates_acceptance_of :title, accept: "omg" end MODEL require "#{rails_root}/config/environment" setup_ar! - p = Post.create(:title => 'omg') + p = Post.create(title: 'omg') assert_equal 1, Post.count assert_equal 'omg', p.title p = Post.first @@ -36,7 +36,7 @@ class LoadingTest < ActiveSupport::TestCase test "models without table do not panic on scope definitions when loaded" do app_file "app/models/user.rb", <<-MODEL class User < ActiveRecord::Base - default_scope where(:published => true) + default_scope where(published: true) end MODEL @@ -76,8 +76,8 @@ class LoadingTest < ActiveSupport::TestCase app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get '/load', :to => lambda { |env| [200, {}, Post.all] } - get '/unload', :to => lambda { |env| [200, {}, []] } + get '/load', to: lambda { |env| [200, {}, Post.all] } + get '/unload', to: lambda { |env| [200, {}, []] } end RUBY @@ -106,7 +106,7 @@ class LoadingTest < ActiveSupport::TestCase app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get '/c', :to => lambda { |env| [200, {"Content-Type" => "text/plain"}, [User.counter.to_s]] } + get '/c', to: lambda { |env| [200, {"Content-Type" => "text/plain"}, [User.counter.to_s]] } end RUBY @@ -145,7 +145,7 @@ class LoadingTest < ActiveSupport::TestCase app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get '/c', :to => lambda { |env| [200, {"Content-Type" => "text/plain"}, [User.counter.to_s]] } + get '/c', to: lambda { |env| [200, {"Content-Type" => "text/plain"}, [User.counter.to_s]] } end RUBY @@ -181,7 +181,7 @@ class LoadingTest < ActiveSupport::TestCase app_file 'config/routes.rb', <<-RUBY $counter = 0 AppTemplate::Application.routes.draw do - get '/c', :to => lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] } + get '/c', to: lambda { |env| User; [200, {"Content-Type" => "text/plain"}, [$counter.to_s]] } end RUBY @@ -212,8 +212,8 @@ class LoadingTest < ActiveSupport::TestCase app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get '/title', :to => lambda { |env| [200, {"Content-Type" => "text/plain"}, [Post.new.title]] } - get '/body', :to => lambda { |env| [200, {"Content-Type" => "text/plain"}, [Post.new.body]] } + get '/title', to: lambda { |env| [200, {"Content-Type" => "text/plain"}, [Post.new.title]] } + get '/body', to: lambda { |env| [200, {"Content-Type" => "text/plain"}, [Post.new.body]] } end RUBY @@ -229,7 +229,7 @@ class LoadingTest < ActiveSupport::TestCase class CreatePosts < ActiveRecord::Migration def change create_table :posts do |t| - t.string :title, :default => "TITLE" + t.string :title, default: "TITLE" end end end @@ -244,7 +244,7 @@ class LoadingTest < ActiveSupport::TestCase app_file "db/migrate/2_add_body_to_posts.rb", <<-MIGRATION class AddBodyToPosts < ActiveRecord::Migration def change - add_column :posts, :body, :text, :default => "BODY" + add_column :posts, :body, :text, default: "BODY" end end MIGRATION @@ -297,9 +297,9 @@ class LoadingTest < ActiveSupport::TestCase protected def setup_ar! - ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") + ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") ActiveRecord::Migration.verbose = false - ActiveRecord::Schema.define(:version => 1) do + ActiveRecord::Schema.define(version: 1) do create_table :posts do |t| t.string :title end diff --git a/railties/test/application/middleware/cache_test.rb b/railties/test/application/middleware/cache_test.rb index fffe79f9cc..9b6c76e7aa 100644 --- a/railties/test/application/middleware/cache_test.rb +++ b/railties/test/application/middleware/cache_test.rb @@ -19,17 +19,17 @@ module ApplicationTests controller :expires, <<-RUBY class ExpiresController < ApplicationController def expires_header - expires_in 10, :public => !params[:private] - render :text => SecureRandom.hex(16) + expires_in 10, public: !params[:private] + render text: SecureRandom.hex(16) end def expires_etag - render_conditionally(:etag => "1") + render_conditionally(etag: "1") end def expires_last_modified $last_modified ||= Time.now.utc - render_conditionally(:last_modified => $last_modified) + render_conditionally(last_modified: $last_modified) end def keeps_if_modified_since @@ -37,8 +37,8 @@ module ApplicationTests end private def render_conditionally(headers) - if stale?(headers.merge(:public => !params[:private])) - render :text => SecureRandom.hex(16) + if stale?(headers.merge(public: !params[:private])) + render text: SecureRandom.hex(16) end end end @@ -96,13 +96,13 @@ module ApplicationTests def test_cache_works_with_expires_private simple_controller - get "/expires/expires_header", :private => true + get "/expires/expires_header", private: true assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_equal "private, max-age=10", last_response.headers["Cache-Control"] body = last_response.body - get "/expires/expires_header", :private => true + get "/expires/expires_header", private: true assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_not_equal body, last_response.body end @@ -125,14 +125,14 @@ module ApplicationTests def test_cache_works_with_etags_private simple_controller - get "/expires/expires_etag", :private => true + get "/expires/expires_etag", private: true assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_equal "must-revalidate, private, max-age=0", last_response.headers["Cache-Control"] body = last_response.body etag = last_response.headers["ETag"] - get "/expires/expires_etag", {:private => true}, "If-None-Match" => etag + get "/expires/expires_etag", {private: true}, "If-None-Match" => etag assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_not_equal body, last_response.body end @@ -155,14 +155,14 @@ module ApplicationTests def test_cache_works_with_last_modified_private simple_controller - get "/expires/expires_last_modified", :private => true + get "/expires/expires_last_modified", private: true assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_equal "must-revalidate, private, max-age=0", last_response.headers["Cache-Control"] body = last_response.body last = last_response.headers["Last-Modified"] - get "/expires/expires_last_modified", {:private => true}, "If-Modified-Since" => last + get "/expires/expires_last_modified", {private: true}, "If-Modified-Since" => last assert_equal "miss", last_response.headers["X-Rack-Cache"] assert_not_equal body, last_response.body end diff --git a/railties/test/application/middleware/session_test.rb b/railties/test/application/middleware/session_test.rb index 06dec81d40..5ce41caf61 100644 --- a/railties/test/application/middleware/session_test.rb +++ b/railties/test/application/middleware/session_test.rb @@ -36,7 +36,7 @@ module ApplicationTests flash[:notice] = "notice" end - render :nothing => true + render nothing: true end end diff --git a/railties/test/application/middleware_test.rb b/railties/test/application/middleware_test.rb index b2443e6503..c03d35e926 100644 --- a/railties/test/application/middleware_test.rb +++ b/railties/test/application/middleware_test.rb @@ -81,10 +81,10 @@ module ApplicationTests test "ActionDispatch::SSL is configured with options when given" do add_to_config "config.force_ssl = true" - add_to_config "config.ssl_options = { :host => 'example.com' }" + add_to_config "config.ssl_options = { host: 'example.com' }" boot! - assert_equal AppTemplate::Application.middleware.first.args, [{:host => 'example.com'}] + assert_equal AppTemplate::Application.middleware.first.args, [{host: 'example.com'}] end test "removing Active Record omits its middleware" do @@ -169,9 +169,9 @@ module ApplicationTests class ::OmgController < ActionController::Base def index if params[:nothing] - render :text => "" + render text: "" else - render :text => "OMG" + render text: "OMG" end end end diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb index 2e7426150c..c5a68a5152 100644 --- a/railties/test/application/rake_test.rb +++ b/railties/test/application/rake_test.rb @@ -46,7 +46,7 @@ module ApplicationTests end rake_tasks do - task :do_nothing => :environment do + task do_nothing: :environment do end end RUBY @@ -60,7 +60,7 @@ module ApplicationTests config.eager_load = true rake_tasks do - task :do_nothing => :environment do + task do_nothing: :environment do Hello.new.world end end @@ -109,7 +109,7 @@ module ApplicationTests def test_rake_routes_calls_the_route_inspector app_file "config/routes.rb", <<-RUBY AppTemplate::Application.routes.draw do - get '/cart', :to => 'cart#show' + get '/cart', to: 'cart#show' end RUBY assert_equal "cart GET /cart(.:format) cart#show\n", Dir.chdir(app_path){ `rake routes` } @@ -118,7 +118,7 @@ module ApplicationTests def test_logger_is_flushed_when_exiting_production_rake_tasks add_to_config <<-RUBY rake_tasks do - task :log_something => :environment do + task log_something: :environment do Rails.logger.error("Sample log message") end end @@ -233,7 +233,7 @@ module ApplicationTests app_file "lib/tasks/count_user.rake", <<-RUBY namespace :user do - task :count => :environment do + task count: :environment do puts User.count end end diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb index 396b1849d8..ffcdeac7f0 100644 --- a/railties/test/application/routing_test.rb +++ b/railties/test/application/routing_test.rb @@ -50,7 +50,7 @@ module ApplicationTests controller :foo, <<-RUBY class FooController < ApplicationController def index - render :inline => "<%= foo_or_bar? %>" + render inline: "<%= foo_or_bar? %>" end end RUBY @@ -76,7 +76,7 @@ module ApplicationTests test "mount rack app" do app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - mount lambda { |env| [200, {}, [env["PATH_INFO"]]] }, :at => "/blog" + mount lambda { |env| [200, {}, [env["PATH_INFO"]]] }, at: "/blog" # The line below is required because mount sometimes # fails when a resource route is added. resource :user @@ -91,7 +91,7 @@ module ApplicationTests controller :foo, <<-RUBY class FooController < ApplicationController def index - render :text => "foo" + render text: "foo" end end RUBY @@ -99,7 +99,7 @@ module ApplicationTests controller :bar, <<-RUBY class BarController < ActionController::Base def index - render :text => "bar" + render text: "bar" end end RUBY @@ -121,7 +121,7 @@ module ApplicationTests controller 'foo', <<-RUBY class FooController < ApplicationController def index - render :text => "foo" + render text: "foo" end end RUBY @@ -130,7 +130,7 @@ module ApplicationTests module Admin class FooController < ApplicationController def index - render :text => "admin::foo" + render text: "admin::foo" end end end @@ -138,8 +138,8 @@ module ApplicationTests app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get 'admin/foo', :to => 'admin/foo#index' - get 'foo', :to => 'foo#index' + get 'admin/foo', to: 'admin/foo#index' + get 'foo', to: 'foo#index' end RUBY @@ -183,18 +183,18 @@ module ApplicationTests controller :foo, <<-RUBY class FooController < ApplicationController def bar - render :text => "bar" + render text: "bar" end def baz - render :text => "baz" + render text: "baz" end end RUBY app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get 'foo', :to => 'foo#bar' + get 'foo', to: 'foo#bar' end RUBY @@ -205,7 +205,7 @@ module ApplicationTests app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get 'foo', :to => 'foo#baz' + get 'foo', to: 'foo#baz' end RUBY @@ -226,7 +226,7 @@ module ApplicationTests app_file 'config/routes.rb', <<-RUBY AppTemplate::Application.routes.draw do - get 'foo', :to => ::InitializeRackApp + get 'foo', to: ::InitializeRackApp end RUBY @@ -257,7 +257,7 @@ module ApplicationTests controller 'yazilar', <<-RUBY class YazilarController < ApplicationController def index - render :text => 'yazilar#index' + render text: 'yazilar#index' end end RUBY diff --git a/railties/test/application/url_generation_test.rb b/railties/test/application/url_generation_test.rb index f7e60749a7..4ecb94b65e 100644 --- a/railties/test/application/url_generation_test.rb +++ b/railties/test/application/url_generation_test.rb @@ -15,7 +15,7 @@ module ApplicationTests class MyApp < Rails::Application config.secret_token = "3b7cd727ee24e8444053437c36cc66c4" - config.session_store :cookie_store, :key => "_myapp_session" + config.session_store :cookie_store, key: "_myapp_session" config.active_support.deprecation = :log end @@ -26,12 +26,12 @@ module ApplicationTests class ::OmgController < ::ApplicationController def index - render :text => omg_path + render text: omg_path end end MyApp.routes.draw do - get "/" => "omg#index", :as => :omg + get "/" => "omg#index", as: :omg end require 'rack/test' |