From 783763bde97bea3d0c200038453008a8cfff1e88 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 6 Aug 2016 19:16:09 +0200 Subject: applies new string literal convention in railties/test The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. --- railties/test/application/assets_test.rb | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'railties/test/application/assets_test.rb') diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb index 20329c6e60..3b5bf7ce87 100644 --- a/railties/test/application/assets_test.rb +++ b/railties/test/application/assets_test.rb @@ -1,6 +1,6 @@ -require 'isolation/abstract_unit' -require 'rack/test' -require 'active_support/json' +require "isolation/abstract_unit" +require "rack/test" +require "active_support/json" module ApplicationTests class AssetsTest < ActiveSupport::TestCase @@ -35,7 +35,7 @@ module ApplicationTests def clean_assets! quietly do - assert Dir.chdir(app_path) { system('bin/rails assets:clobber') } + assert Dir.chdir(app_path) { system("bin/rails assets:clobber") } end end @@ -52,7 +52,7 @@ module ApplicationTests app_file "app/assets/images/rails.png", "notactuallyapng" app_file "app/assets/javascripts/demo.js.erb", "a = <%= image_path('rails.png').inspect %>;" - app_file 'config/routes.rb', <<-RUBY + app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, ["Not an asset"]] } end @@ -110,8 +110,8 @@ module ApplicationTests eoruby precompile! \ - RAILS_ENV: 'production', - DATABASE_URL: 'postgresql://baduser:badpass@127.0.0.1/dbname' + RAILS_ENV: "production", + DATABASE_URL: "postgresql://baduser:badpass@127.0.0.1/dbname" files = Dir["#{app_path}/public/assets/application-*.js"] files << Dir["#{app_path}/public/assets/foo/application-*.js"].first @@ -176,19 +176,19 @@ module ApplicationTests assert_file_exists("#{app_path}/public/assets/something/index-*.js") end - test 'precompile use assets defined in app env config' do - add_to_env_config 'production', 'config.assets.precompile = [ "something.js" ]' - app_file 'app/assets/javascripts/something.js.erb', 'alert();' + test "precompile use assets defined in app env config" do + add_to_env_config "production", 'config.assets.precompile = [ "something.js" ]' + app_file "app/assets/javascripts/something.js.erb", "alert();" - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" assert_file_exists("#{app_path}/public/assets/something-*.js") end - test 'sprockets cache is not shared between environments' do + test "sprockets cache is not shared between environments" do app_file "app/assets/images/rails.png", "notactuallyapng" app_file "app/assets/stylesheets/application.css.erb", "body { background: '<%= asset_path('rails.png') %>'; }" - add_to_env_config 'production', 'config.assets.prefix = "production_assets"' + add_to_env_config "production", 'config.assets.prefix = "production_assets"' precompile! @@ -197,7 +197,7 @@ module ApplicationTests file = Dir["#{app_path}/public/assets/application-*.css"].first assert_match(/assets\/rails-([0-z]+)\.png/, File.read(file)) - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" assert_file_exists("#{app_path}/public/production_assets/application-*.css") @@ -205,17 +205,17 @@ module ApplicationTests assert_match(/production_assets\/rails-([0-z]+)\.png/, File.read(file)) end - test 'precompile use assets defined in app config and reassigned in app env config' do + test "precompile use assets defined in app config and reassigned in app env config" do add_to_config 'config.assets.precompile = [ "something_manifest.js" ]' - add_to_env_config 'production', 'config.assets.precompile += [ "another_manifest.js" ]' + add_to_env_config "production", 'config.assets.precompile += [ "another_manifest.js" ]' - app_file 'app/assets/config/something_manifest.js', '//= link something.js' - app_file 'app/assets/config/another_manifest.js', '//= link another.js' + app_file "app/assets/config/something_manifest.js", "//= link something.js" + app_file "app/assets/config/another_manifest.js", "//= link another.js" - app_file 'app/assets/javascripts/something.js.erb', 'alert();' - app_file 'app/assets/javascripts/another.js.erb', 'alert();' + app_file "app/assets/javascripts/something.js.erb", "alert();" + app_file "app/assets/javascripts/another.js.erb", "alert();" - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" assert_file_exists("#{app_path}/public/assets/something_manifest-*.js") assert_file_exists("#{app_path}/public/assets/something-*.js") @@ -261,7 +261,7 @@ module ApplicationTests app_file "app/assets/javascripts/application.js", "alert();" add_to_env_config "production", "config.public_file_server.enabled = true" - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first assets = ActiveSupport::JSON.decode(File.read(manifest)) @@ -292,7 +292,7 @@ module ApplicationTests app_file "app/assets/stylesheets/application.css.erb", "p { background-image: url(<%= asset_path('rails.png') %>) }" - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" manifest = Dir["#{app_path}/public/assets/.sprockets-manifest-*.json"].first assets = ActiveSupport::JSON.decode(File.read(manifest)) @@ -310,7 +310,7 @@ module ApplicationTests app_file "app/assets/images/rails.png", "notactuallyapng" app_file "app/assets/stylesheets/application.css.erb", "p { background-image: url(<%= asset_path('rails.png') %>) }" - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" file = Dir["#{app_path}/public/assets/application-*.css"].first assert_match(/\/assets\/rails-([0-z]+)\.png/, File.read(file)) @@ -380,7 +380,7 @@ module ApplicationTests end get "/omg" - assert_equal 'ok', last_response.body + assert_equal "ok", last_response.body get "/assets/demo.js" assert_match "alert()", last_response.body @@ -408,7 +408,7 @@ module ApplicationTests app_with_assets_in_view # config.assets.debug and config.assets.compile are false for production environment - precompile! RAILS_ENV: 'production' + precompile! RAILS_ENV: "production" # Load app env app "production" @@ -416,7 +416,7 @@ module ApplicationTests class ::PostsController < ActionController::Base ; end # the debug_assets params isn't used if compile is off - get '/posts?debug_assets=true' + get "/posts?debug_assets=true" assert_match(/