From 68a9d6367e1bb4e095b78555c16955e9ce612832 Mon Sep 17 00:00:00 2001 From: Ashik Salman Date: Sat, 24 Apr 2021 23:16:43 +0530 Subject: [PATCH] Used double quotes in template file for consistency. --- .../active_record/model/templates/model.rb.tt | 2 +- .../model/templates/module.rb.tt | 4 +- railties/lib/rails/generators/actions.rb | 4 +- railties/lib/rails/generators/app_base.rb | 2 +- railties/lib/rails/generators/app_name.rb | 2 +- .../generators/rails/app/templates/Gemfile.tt | 42 ++++++------ .../templates/config/databases/jdbc.yml.tt | 4 +- .../config/databases/jdbcmysql.yml.tt | 6 +- .../config/databases/jdbcpostgresql.yml.tt | 6 +- .../config/databases/jdbcsqlite3.yml.tt | 4 +- .../templates/config/databases/mysql.yml.tt | 6 +- .../templates/config/databases/oracle.yml.tt | 4 +- .../config/databases/postgresql.yml.tt | 6 +- .../templates/config/databases/sqlite3.yml.tt | 2 +- .../config/databases/sqlserver.yml.tt | 10 +-- .../application_controller_renderer.rb.tt | 2 +- .../templates/config/initializers/cors.rb.tt | 4 +- .../config/initializers/inflections.rb.tt | 8 +-- .../rails/app/templates/config/locales/en.yml | 6 +- .../rails/app/templates/db/seeds.rb.tt | 4 +- .../db/system/change/change_generator.rb | 2 +- .../templates/%file_name%_generator.rb.tt | 2 +- .../rails/plugin/plugin_generator.rb | 4 +- .../rails/plugin/templates/%name%.gemspec.tt | 4 +- .../rails/plugin/templates/Gemfile.tt | 16 ++--- .../rails/plugin/templates/README.md.tt | 2 +- .../application_mailer.rb.tt | 4 +- .../lib/%namespaced_name%/engine.rb.tt | 4 +- .../lib/%namespaced_name%/version.rb.tt | 2 +- .../rails/plugin/templates/rails/boot.rb.tt | 4 +- .../plugin/templates/test/test_helper.rb.tt | 6 +- .../generator/templates/generator_test.rb.tt | 2 +- .../test_unit/model/templates/fixtures.yml.tt | 4 +- .../test_unit/scaffold/scaffold_generator.rb | 2 +- .../templates/api_functional_test.rb.tt | 4 +- .../scaffold/templates/functional_test.rb.tt | 4 +- .../lib/rails/generators/testing/behaviour.rb | 2 +- railties/test/generators/actions_test.rb | 66 +++++++++---------- .../test/generators/api_app_generator_test.rb | 12 ++-- .../test/generators/app_generator_test.rb | 26 ++++---- .../generators/benchmark_generator_test.rb | 4 +- .../db_system_change_generator_test.rb | 8 +-- .../test/generators/model_generator_test.rb | 2 +- .../generators/namespaced_generators_test.rb | 2 +- .../test/generators/plugin_generator_test.rb | 28 ++++---- .../generators/scaffold_generator_test.rb | 10 +-- railties/test/railties/generators_test.rb | 2 +- 47 files changed, 178 insertions(+), 178 deletions(-) diff --git a/activerecord/lib/rails/generators/active_record/model/templates/model.rb.tt b/activerecord/lib/rails/generators/active_record/model/templates/model.rb.tt index 77b9ea1c86..e2c7e4e1f8 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/model.rb.tt +++ b/activerecord/lib/rails/generators/active_record/model/templates/model.rb.tt @@ -1,7 +1,7 @@ <% module_namespacing do -%> class <%= class_name %> < <%= parent_class_name.classify %> <% attributes.select(&:reference?).each do |attribute| -%> - belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %> + belongs_to :<%= attribute.name %><%= ", polymorphic: true" if attribute.polymorphic? %> <% end -%> <% attributes.select(&:rich_text?).each do |attribute| -%> has_rich_text :<%= attribute.name %> diff --git a/activerecord/lib/rails/generators/active_record/model/templates/module.rb.tt b/activerecord/lib/rails/generators/active_record/model/templates/module.rb.tt index a3bf1c37b6..a38f8b93e2 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/module.rb.tt +++ b/activerecord/lib/rails/generators/active_record/model/templates/module.rb.tt @@ -1,7 +1,7 @@ <% module_namespacing do -%> -module <%= class_path.map(&:camelize).join('::') %> +module <%= class_path.map(&:camelize).join("::") %> def self.table_name_prefix - '<%= namespaced? ? namespaced_class_path.join('_') : class_path.join('_') %>_' + "<%= namespaced? ? namespaced_class_path.join("_") : class_path.join("_") %>_" end end <% end -%> diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index cdf7b0e509..bbf5b10d44 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -334,9 +334,9 @@ module Rails return value.inspect unless value.is_a? String if value.include?("'") - value.inspect + value.tr("'", '"') else - "'#{value}'" + "\"#{value}\"" end end diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 4a8361b29a..3280d722fd 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -257,7 +257,7 @@ module Rails version = super if version.is_a?(Array) - version.join("', '") + version.join('", "') else version end diff --git a/railties/lib/rails/generators/app_name.rb b/railties/lib/rails/generators/app_name.rb index 5bb735c4e8..1ca21bed78 100644 --- a/railties/lib/rails/generators/app_name.rb +++ b/railties/lib/rails/generators/app_name.rb @@ -7,7 +7,7 @@ module Rails private def app_name - @app_name ||= original_app_name.tr('\\', "").tr("-. ", "_") + @app_name ||= original_app_name.tr("\\", "").tr("-. ", "_") end def original_app_name diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt index e3e7099814..dffc0dd922 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile.tt +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile.tt @@ -1,7 +1,7 @@ -source 'https://rubygems.org' +source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby <%= "'#{RUBY_VERSION}'" -%> +ruby <%= "\"#{RUBY_VERSION}\"" -%> <% unless gemfile_entries.first&.comment -%> @@ -11,68 +11,68 @@ ruby <%= "'#{RUBY_VERSION}'" -%> # <%= gem.comment %> <% end -%> -<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%> +<%= gem.commented_out ? "# " : "" %>gem "<%= gem.name %>"<%= %(, "#{gem.version}") if gem.version -%> <% if gem.options.any? -%> , <%= gem.options.map { |k,v| - "#{k}: #{v.inspect.gsub('"', '\'')}" }.join(', ') %> + "#{k}: #{v.inspect.gsub('"', '\'')}" }.join(", ") %> <% end -%> <% end -%> # Use Active Model has_secure_password -# gem 'bcrypt', '~> 3.1.7' +# gem "bcrypt", "~> 3.1.7" <% unless skip_active_storage? -%> # Use Active Storage variant -# gem 'image_processing', '~> 1.2' +# gem "image_processing", "~> 1.2" <% end -%> <% if depend_on_bootsnap? -%> # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.4', require: false +gem "bootsnap", ">= 1.4.4", require: false <%- end -%> <%- if options.api? -%> # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible -# gem 'rack-cors' +# gem "rack-cors" <%- end -%> -<% if RUBY_ENGINE == 'ruby' -%> +<% if RUBY_ENGINE == "ruby" -%> group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console - gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] + # Call "byebug" anywhere in the code to stop execution and get a debugger console + gem "byebug", platforms: [:mri, :mingw, :x64_mingw] end <% end -%> group :development do <%- unless options.api? || options.skip_dev_gems? -%> - # Access an interactive console on exception pages or by calling 'console' anywhere in the code. + # Access an interactive console on exception pages or by calling "console" anywhere in the code. <%- if options.dev? || options.edge? || options.main? -%> - gem 'web-console', github: 'rails/web-console' + gem "web-console", github: "rails/web-console" <%- else -%> - gem 'web-console', '>= 4.1.0' + gem "web-console", ">= 4.1.0" <%- end -%> # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md - gem 'rack-mini-profiler', '~> 2.0' + gem "rack-mini-profiler", "~> 2.0" <%- end -%> <% if depend_on_listen? -%> - gem 'listen', '~> 3.3' + gem "listen", "~> 3.3" <% end -%> <% if spring_install? -%> # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' + gem "spring" <% end -%> end <%- if depends_on_system_test? -%> group :test do # Adds support for Capybara system testing and selenium driver - gem 'capybara', '>= 3.26' - gem 'selenium-webdriver' + gem "capybara", ">= 3.26" + gem "selenium-webdriver" # Easy installation and use of web drivers to run system tests with browsers - gem 'webdrivers' + gem "webdrivers" end <%- end -%> # Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt index d0956a89d7..ed87606749 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt @@ -3,7 +3,7 @@ # gem install activerecord-jdbcmssql-adapter # # Configure using Gemfile: -# gem 'activerecord-jdbcmssql-adapter' +# gem "activerecord-jdbcmssql-adapter" # # development: # adapter: mssql @@ -65,4 +65,4 @@ test: production: url: jdbc:db://localhost/<%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt index 6d3cf09d3c..7b3b100e42 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt @@ -4,7 +4,7 @@ # gem install activerecord-jdbcmysql-adapter # # Configure Using Gemfile -# gem 'activerecord-jdbcmysql-adapter' +# gem "activerecord-jdbcmysql-adapter" # # And be sure to use new-style password hashing: # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html @@ -42,7 +42,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -51,4 +51,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt index a4ca9707f8..40261ec9fa 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt @@ -1,7 +1,7 @@ # PostgreSQL. Versions 9.3 and up are supported. # # Configure Using Gemfile -# gem 'activerecord-jdbcpostgresql-adapter' +# gem "activerecord-jdbcpostgresql-adapter" # default: &default adapter: postgresql @@ -58,7 +58,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -67,4 +67,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt index 006b0a74c3..701073c7fd 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt @@ -1,8 +1,8 @@ # SQLite. Versions 3.8.0 and up are supported. -# gem 'activerecord-jdbcsqlite3-adapter' +# gem "activerecord-jdbcsqlite3-adapter" # # Configure Using Gemfile -# gem 'activerecord-jdbcsqlite3-adapter' +# gem "activerecord-jdbcsqlite3-adapter" # default: &default adapter: sqlite3 diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt index c446fc2dda..c0b48fae02 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt @@ -4,7 +4,7 @@ # gem install mysql2 # # Ensure the MySQL gem is defined in your Gemfile -# gem 'mysql2' +# gem "mysql2" # # And be sure to use new-style password hashing: # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html @@ -47,7 +47,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -56,4 +56,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt index 2be2bf21d3..c1a28185fe 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt @@ -50,7 +50,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -59,4 +59,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt index 6b2c5682b2..ff822417ab 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt @@ -12,7 +12,7 @@ # Install PostgreSQL and put its /bin directory on your path. # # Configure Using Gemfile -# gem 'pg' +# gem "pg" # default: &default adapter: postgresql @@ -74,7 +74,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -83,4 +83,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt index a7c2bf2eac..0e1b55b674 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt @@ -2,7 +2,7 @@ # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' +# gem "sqlite3" # default: &default adapter: sqlite3 diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt index 65cc8cdfd3..22a4863367 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt @@ -5,14 +5,14 @@ # gem install activerecord-sqlserver-adapter # # Ensure the activerecord adapter and db driver gems are defined in your Gemfile -# gem 'tiny_tds' -# gem 'activerecord-sqlserver-adapter' +# gem "tiny_tds" +# gem "activerecord-sqlserver-adapter" # default: &default adapter: sqlserver encoding: utf8 username: sa - password: <%%= ENV['SA_PASSWORD'] %> + password: <%%= ENV["SA_PASSWORD"] %> host: localhost development: @@ -41,7 +41,7 @@ test: # URL environment variable explicitly: # # production: -# url: <%%= ENV['MY_APP_DATABASE_URL'] %> +# url: <%%= ENV["MY_APP_DATABASE_URL"] %> # # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database # for a full overview on how database connection configuration can be specified. @@ -50,4 +50,4 @@ production: <<: *default database: <%= app_name %>_production username: <%= app_name %> - password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %> + password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %> diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt index 89d2efab2b..05f1fb0e3c 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt @@ -2,7 +2,7 @@ # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', +# http_host: "example.org", # https: false # ) # end diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt index 3b1c1b5ed1..e5a82f162c 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt @@ -7,9 +7,9 @@ # Rails.application.config.middleware.insert_before 0, Rack::Cors do # allow do -# origins 'example.com' +# origins "example.com" # -# resource '*', +# resource "*", # headers: :any, # methods: [:get, :post, :put, :patch, :delete, :options, :head] # end diff --git a/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt index ac033bf9dc..ceb4902f3c 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\1en" +# inflect.singular /^(ox)en/i, "\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml index cf9b342d0a..8ca56fc74f 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml @@ -4,11 +4,11 @@ # # To use the locales, use `I18n.t`: # -# I18n.t 'hello' +# I18n.t "hello" # # In views, this is aliased to just `t`: # -# <%= t('hello') %> +# <%= t("hello") %> # # To use a different locale, set it with `I18n.locale`: # @@ -24,7 +24,7 @@ # Instead, surround them with single quotes. # # en: -# 'true': 'foo' +# "true": "foo" # # To learn more, please read the Rails Internationalization guide # available at https://guides.rubyonrails.org/i18n.html. diff --git a/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt b/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt index f3a0480d18..bc25fce306 100644 --- a/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt @@ -3,5 +3,5 @@ # # Examples: # -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }]) +# Character.create(name: "Luke", movie: movies.first) diff --git a/railties/lib/rails/generators/rails/db/system/change/change_generator.rb b/railties/lib/rails/generators/rails/db/system/change/change_generator.rb index 24db92fad7..3187c66ad7 100644 --- a/railties/lib/rails/generators/rails/db/system/change/change_generator.rb +++ b/railties/lib/rails/generators/rails/db/system/change/change_generator.rb @@ -55,7 +55,7 @@ module Rails end def gem_entry_for(*gem_name_and_version) - gem_name_and_version.map! { |segment| "'#{segment}'" } + gem_name_and_version.map! { |segment| "\"#{segment}\"" } "gem #{gem_name_and_version.join(", ")}" end end diff --git a/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt b/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt index 178d5c3f9f..766bd3f381 100644 --- a/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +++ b/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt @@ -1,3 +1,3 @@ class <%= class_name %>Generator < Rails::Generators::NamedBase - source_root File.expand_path('templates', __dir__) + source_root File.expand_path("templates", __dir__) end diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index acdd5c6f28..d1e372d241 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -424,8 +424,8 @@ module Rails require "rake/testtask" Rake::TestTask.new(:test) do |t| - t.libs << 'test' - t.pattern = 'test/**/*_test.rb' + t.libs << "test" + t.pattern = "test/**/*_test.rb" t.verbose = false end RUBY diff --git a/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt b/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt index 34733d291b..273d4351e8 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.license = "MIT" <% end -%> - # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host" # to allow pushing to a single host or delete this section to allow pushing to any host. spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" @@ -22,5 +22,5 @@ Gem::Specification.new do |spec| spec.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"] - <%= '# ' if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>" + <%= "# " if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>" end diff --git a/railties/lib/rails/generators/rails/plugin/templates/Gemfile.tt b/railties/lib/rails/generators/rails/plugin/templates/Gemfile.tt index 7776116a76..d5cb96f088 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/Gemfile.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/Gemfile.tt @@ -1,8 +1,8 @@ -source 'https://rubygems.org' +source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } <% if options[:skip_gemspec] -%> -<%= '# ' if options.dev? || options.edge? || options.main? -%>gem 'rails', '<%= Array(rails_version_specifier).join("', '") %>' +<%= "# " if options.dev? || options.edge? || options.main? -%>gem "rails", "<%= Array(rails_version_specifier).join("', '") %>" <% else -%> # Specify your gem's dependencies in <%= name %>.gemspec. gemspec @@ -10,7 +10,7 @@ gemspec <% unless options[:skip_active_record] -%> group :development do - gem '<%= gem_for_database[0] %>' + gem "<%= gem_for_database[0] %>" end <% end -%> @@ -23,19 +23,19 @@ end # <%= gem.comment %> <% end -%> -<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%> +<%= gem.commented_out ? "# " : "" %>gem "<%= gem.name %>"<%= %(, "#{gem.version}") if gem.version -%> <% if gem.options.any? -%> , <%= gem.options.map { |k,v| - "#{k}: #{v.inspect}" }.join(', ') %> + "#{k}: #{v.inspect}" }.join(", ") %> <% end -%> <% end -%> <% end -%> -<% if RUBY_ENGINE == 'ruby' -%> +<% if RUBY_ENGINE == "ruby" -%> # To use a debugger -# gem 'byebug', group: [:development, :test] +# gem "byebug", group: [:development, :test] <% end -%> <% if RUBY_PLATFORM.match(/bccwin|cygwin|emx|mingw|mswin|wince|java/) -%> -gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] <% end -%> diff --git a/railties/lib/rails/generators/rails/plugin/templates/README.md.tt b/railties/lib/rails/generators/rails/plugin/templates/README.md.tt index 1632409bea..c14ce81b34 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/README.md.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/README.md.tt @@ -8,7 +8,7 @@ How to use my plugin. Add this line to your application's Gemfile: ```ruby -gem '<%= name %>' +gem "<%= name %>" ``` And then execute: diff --git a/railties/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt index 246e274348..b3ef3f4b65 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt @@ -1,7 +1,7 @@ <%= wrap_in_modules <<~rb class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' + default from: "from@example.com" + layout "mailer" end rb %> diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt index 4ec1804940..fbb62d54be 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt @@ -1,7 +1,7 @@ <%= wrap_in_modules <<~rb class Engine < ::Rails::Engine - #{mountable? ? ' isolate_namespace ' + camelized_modules : ' '} - #{api? ? " config.generators.api_only = true" : ' '} + #{mountable? ? " isolate_namespace " + camelized_modules : " "} + #{api? ? " config.generators.api_only = true" : " "} end rb %> diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt index b08f4ef9ae..6da2b0c85d 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt @@ -1 +1 @@ -<%= wrap_in_modules "VERSION = '0.1.0'" %> +<%= wrap_in_modules 'VERSION = "0.1.0"' %> diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt index 91e50810ef..116591a4ed 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt @@ -1,5 +1,5 @@ # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) -$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__) +$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) diff --git a/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt index d0e863fb6d..409641267a 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt @@ -1,18 +1,18 @@ # Configure Rails Environment ENV["RAILS_ENV"] = "test" -require_relative "<%= File.join('..', options[:dummy_path], 'config/environment') -%>" +require_relative "<%= File.join("..", options[:dummy_path], "config/environment") -%>" <% unless options[:skip_active_record] -%> ActiveRecord::Migrator.migrations_paths = [File.expand_path("../<%= options[:dummy_path] -%>/db/migrate", __dir__)] <% if options[:mountable] -%> -ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__) +ActiveRecord::Migrator.migrations_paths << File.expand_path("../db/migrate", __dir__) <% end -%> <% end -%> require "rails/test_help" <% unless engine? -%> require "rails/test_unit/reporter" -Rails::TestUnitReporter.executable = 'bin/test' +Rails::TestUnitReporter.executable = "bin/test" <% end -%> <% unless options[:skip_active_record] -%> diff --git a/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt b/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt index 5b07e57dbd..2dc0f76a43 100644 --- a/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +++ b/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt @@ -4,7 +4,7 @@ require "<%= generator_path %>" <% module_namespacing do -%> class <%= class_name %>GeneratorTest < Rails::Generators::TestCase tests <%= class_name %>Generator - destination Rails.root.join('tmp/generators') + destination Rails.root.join("tmp/generators") setup :prepare_destination # test "generator runs without errors" do diff --git a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt index 5f7e76bb76..3d79f247e9 100644 --- a/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +++ b/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt @@ -4,7 +4,7 @@ <%= name %>: <% attributes.each do |attribute| -%> <%- if attribute.password_digest? -%> - password_digest: <%%= BCrypt::Password.create('secret') %> + password_digest: <%%= BCrypt::Password.create("secret") %> <%- elsif attribute.reference? -%> <%= yaml_key_value(attribute.column_name.delete_suffix("_id"), attribute.default || name) %> <%- elsif !attribute.virtual? -%> @@ -18,7 +18,7 @@ <% else -%> # This model initially had no columns defined. If you add columns to the -# model remove the '{}' from the fixture names and add the columns immediately +# model remove the "{}" from the fixture names and add the columns immediately # below each fixture, per the syntax in the comments below # one: {} diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb index 3a82081d6a..f1601f25d8 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb @@ -47,7 +47,7 @@ module TestUnit # :nodoc: attributes_names.filter_map do |name| if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?) - ["#{name}", "'secret'"] + ["#{name}", '"secret"'] elsif !virtual?(name) ["#{name}", "@#{singular_table_name}.#{name}"] end diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt index f544a1b945..4b00b3ff39 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt @@ -16,7 +16,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end test "should create <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count') do + assert_difference("<%= class_name %>.count") do post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> }, as: :json end @@ -34,7 +34,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end test "should destroy <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count', -1) do + assert_difference("<%= class_name %>.count", -1) do delete <%= show_helper %>, as: :json end diff --git a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt index 6704c8c025..c3b0d615b2 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +++ b/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt @@ -21,7 +21,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end test "should create <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count') do + assert_difference("<%= class_name %>.count") do post <%= index_helper %>_url, params: { <%= "#{singular_table_name}: { #{attributes_string} }" %> } end @@ -44,7 +44,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe end test "should destroy <%= singular_table_name %>" do - assert_difference('<%= class_name %>.count', -1) do + assert_difference("<%= class_name %>.count", -1) do delete <%= show_helper %> end diff --git a/railties/lib/rails/generators/testing/behaviour.rb b/railties/lib/rails/generators/testing/behaviour.rb index e5264c1946..e059308696 100644 --- a/railties/lib/rails/generators/testing/behaviour.rb +++ b/railties/lib/rails/generators/testing/behaviour.rb @@ -82,7 +82,7 @@ module Rails # Create a Rails::Generators::GeneratedAttribute by supplying the # attribute type and, optionally, the attribute name: # - # create_generated_attribute(:string, 'name') + # create_generated_attribute(:string, "name") def create_generated_attribute(attribute_type, name = "test", index = nil) Rails::Generators::GeneratedAttribute.parse([name, attribute_type, index].compact.join(":")) end diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index b83c8e8a82..a689f0d9d9 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -43,7 +43,7 @@ class ActionsTest < Rails::Generators::TestCase def test_add_source_adds_source_to_gemfile run_generator action :add_source, "http://gems.github.com" - assert_file "Gemfile", /source 'http:\/\/gems\.github\.com'\n/ + assert_file "Gemfile", /source "http:\/\/gems\.github\.com"\n/ end def test_add_source_with_block_adds_source_to_gemfile_with_gem @@ -51,7 +51,7 @@ class ActionsTest < Rails::Generators::TestCase action :add_source, "http://gems.github.com" do gem "rspec-rails" end - assert_file "Gemfile", /\n\nsource 'http:\/\/gems\.github\.com' do\n gem 'rspec-rails'\nend\n\z/ + assert_file "Gemfile", /\n\nsource "http:\/\/gems\.github\.com" do\n gem "rspec-rails"\nend\n\z/ end def test_add_source_with_block_adds_source_to_gemfile_after_gem @@ -60,7 +60,7 @@ class ActionsTest < Rails::Generators::TestCase action :add_source, "http://gems.github.com" do gem "rspec-rails" end - assert_file "Gemfile", /\ngem 'will-paginate'\n\nsource 'http:\/\/gems\.github\.com' do\n gem 'rspec-rails'\nend\n\z/ + assert_file "Gemfile", /\ngem "will-paginate"\n\nsource "http:\/\/gems\.github\.com" do\n gem "rspec-rails"\nend\n\z/ end def test_add_source_should_create_newline_between_blocks @@ -72,13 +72,13 @@ class ActionsTest < Rails::Generators::TestCase action :add_source, "http://gems2.github.com" do gem "fakeweb" end - assert_file "Gemfile", /\n\nsource 'http:\/\/gems\.github\.com' do\n gem 'rspec-rails'\nend\n\nsource 'http:\/\/gems2\.github\.com' do\n gem 'fakeweb'\nend\n\z/ + assert_file "Gemfile", /\n\nsource "http:\/\/gems\.github\.com" do\n gem "rspec-rails"\nend\n\nsource "http:\/\/gems2\.github\.com" do\n gem "fakeweb"\nend\n\z/ end def test_gem_should_put_gem_dependency_in_gemfile run_generator action :gem, "will-paginate" - assert_file "Gemfile", /gem 'will-paginate'\n\z/ + assert_file "Gemfile", /gem "will-paginate"\n\z/ end def test_gem_with_version_should_include_version_in_gemfile @@ -89,10 +89,10 @@ class ActionsTest < Rails::Generators::TestCase action :gem, "faker", version: [">= 0.1.0", "< 0.3.0"] assert_file "Gemfile" do |content| - assert_match(/gem 'rspec', '>= 2\.0\.0\.a5'/, content) - assert_match(/gem 'RedCloth', '>= 4\.1\.0', '< 4\.2\.0'/, content) - assert_match(/gem 'nokogiri', '>= 1\.4\.2'/, content) - assert_match(/gem 'faker', '>= 0\.1\.0', '< 0\.3\.0'/, content) + assert_match(/gem "rspec", ">= 2\.0\.0\.a5"/, content) + assert_match(/gem "RedCloth", ">= 4\.1\.0", "< 4\.2\.0"/, content) + assert_match(/gem "nokogiri", ">= 1\.4\.2"/, content) + assert_match(/gem "faker", ">= 0\.1\.0", "< 0\.3\.0"/, content) end end @@ -104,8 +104,8 @@ class ActionsTest < Rails::Generators::TestCase action :gem, "rspec" action :gem, "rspec-rails" - assert_file "Gemfile", /^gem 'rspec'$/ - assert_file "Gemfile", /^gem 'rspec-rails'$/ + assert_file "Gemfile", /^gem "rspec"$/ + assert_file "Gemfile", /^gem "rspec-rails"$/ end def test_gem_should_include_options @@ -113,7 +113,7 @@ class ActionsTest < Rails::Generators::TestCase action :gem, "rspec", github: "dchelimsky/rspec", tag: "1.2.9.rc1" - assert_file "Gemfile", /gem 'rspec', github: 'dchelimsky\/rspec', tag: '1\.2\.9\.rc1'/ + assert_file "Gemfile", /gem "rspec", github: "dchelimsky\/rspec", tag: "1\.2\.9\.rc1"/ end def test_gem_with_non_string_options @@ -122,16 +122,16 @@ class ActionsTest < Rails::Generators::TestCase action :gem, "rspec", require: false action :gem, "rspec-rails", group: [:development, :test] - assert_file "Gemfile", /^gem 'rspec', require: false$/ - assert_file "Gemfile", /^gem 'rspec-rails', group: \[:development, :test\]$/ + assert_file "Gemfile", /^gem "rspec", require: false$/ + assert_file "Gemfile", /^gem "rspec-rails", group: \[:development, :test\]$/ end def test_gem_falls_back_to_inspect_if_string_contains_single_quote run_generator - action :gem, "rspec", ">=2.0'0" + action :gem, "rspec", ">=2.0.0" - assert_file "Gemfile", /^gem 'rspec', ">=2\.0'0"$/ + assert_file "Gemfile", /^gem "rspec", ">=2\.0\.0"$/ end def test_gem_works_even_if_frozen_string_is_passed_as_argument @@ -139,7 +139,7 @@ class ActionsTest < Rails::Generators::TestCase action :gem, -"frozen_gem", -"1.0.0" - assert_file "Gemfile", /^gem 'frozen_gem', '1.0.0'$/ + assert_file "Gemfile", /^gem "frozen_gem", "1\.0\.0"$/ end def test_gem_group_should_wrap_gems_in_a_group @@ -153,7 +153,7 @@ class ActionsTest < Rails::Generators::TestCase gem "fakeweb" end - assert_file "Gemfile", /\n\ngroup :development, :test do\n gem 'rspec-rails'\nend\n\ngroup :test do\n gem 'fakeweb'\nend\n\z/ + assert_file "Gemfile", /\n\ngroup :development, :test do\n gem "rspec-rails"\nend\n\ngroup :test do\n gem "fakeweb"\nend\n\z/ end def test_github_should_create_an_indented_block @@ -165,7 +165,7 @@ class ActionsTest < Rails::Generators::TestCase gem "baz" end - assert_file "Gemfile", /\n\ngithub 'user\/repo' do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend\n\z/ + assert_file "Gemfile", /\n\ngithub "user\/repo" do\n gem "foo"\n gem "bar"\n gem "baz"\nend\n\z/ end def test_github_should_create_an_indented_block_with_options @@ -177,7 +177,7 @@ class ActionsTest < Rails::Generators::TestCase gem "baz" end - assert_file "Gemfile", /\n\ngithub 'user\/repo', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend\n\z/ + assert_file "Gemfile", /\n\ngithub "user\/repo", a: "correct", other: true do\n gem "foo"\n gem "bar"\n gem "baz"\nend\n\z/ end def test_github_should_create_an_indented_block_within_a_group @@ -196,7 +196,7 @@ class ActionsTest < Rails::Generators::TestCase end end - assert_file "Gemfile", /\n\ngroup :magic do\n github 'user\/repo', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\n end\n github 'user\/repo2', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\n end\nend\n\z/ + assert_file "Gemfile", /\n\ngroup :magic do\n github "user\/repo", a: "correct", other: true do\n gem "foo"\n gem "bar"\n gem "baz"\n end\n github "user\/repo2", a: "correct", other: true do\n gem "foo"\n gem "bar"\n gem "baz"\n end\nend\n\z/ end def test_github_should_create_newline_between_blocks @@ -214,48 +214,48 @@ class ActionsTest < Rails::Generators::TestCase gem "baz" end - assert_file "Gemfile", /\n\ngithub 'user\/repo', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend\n\ngithub 'user\/repo2', a: 'correct', other: true do\n gem 'foo'\n gem 'bar'\n gem 'baz'\nend\n\z/ + assert_file "Gemfile", /\n\ngithub "user\/repo", a: "correct", other: true do\n gem "foo"\n gem "bar"\n gem "baz"\nend\n\ngithub "user\/repo2", a: "correct", other: true do\n gem "foo"\n gem "bar"\n gem "baz"\nend\n\z/ end def test_gem_with_gemfile_without_newline_at_the_end run_generator - File.open("Gemfile", "a") { |f| f.write("gem 'rspec-rails'") } + File.open("Gemfile", "a") { |f| f.write('gem "rspec-rails"') } action :gem, "will-paginate" - assert_file "Gemfile", /gem 'rspec-rails'\ngem 'will-paginate'\n\z/ + assert_file "Gemfile", /gem "rspec-rails"\ngem "will-paginate"\n\z/ end def test_gem_group_with_gemfile_without_newline_at_the_end run_generator - File.open("Gemfile", "a") { |f| f.write("gem 'rspec-rails'") } + File.open("Gemfile", "a") { |f| f.write('gem "rspec-rails"') } action :gem_group, :test do gem "fakeweb" end - assert_file "Gemfile", /gem 'rspec-rails'\n\ngroup :test do\n gem 'fakeweb'\nend\n\z/ + assert_file "Gemfile", /gem "rspec-rails"\n\ngroup :test do\n gem "fakeweb"\nend\n\z/ end def test_add_source_with_gemfile_without_newline_at_the_end run_generator - File.open("Gemfile", "a") { |f| f.write("gem 'rspec-rails'") } + File.open("Gemfile", "a") { |f| f.write('gem "rspec-rails"') } action :add_source, "http://gems.github.com" do gem "fakeweb" end - assert_file "Gemfile", /gem 'rspec-rails'\n\nsource 'http:\/\/gems\.github\.com' do\n gem 'fakeweb'\nend\n\z/ + assert_file "Gemfile", /gem "rspec-rails"\n\nsource "http:\/\/gems\.github\.com" do\n gem "fakeweb"\nend\n\z/ end def test_github_with_gemfile_without_newline_at_the_end run_generator - File.open("Gemfile", "a") { |f| f.write("gem 'rspec-rails'") } + File.open("Gemfile", "a") { |f| f.write('gem "rspec-rails"') } action :github, "user/repo" do gem "fakeweb" end - assert_file "Gemfile", /gem 'rspec-rails'\n\ngithub 'user\/repo' do\n gem 'fakeweb'\nend\n\z/ + assert_file "Gemfile", /gem "rspec-rails"\n\ngithub "user\/repo" do\n gem "fakeweb"\nend\n\z/ end def test_environment_should_include_data_in_environment_initializer_block @@ -533,7 +533,7 @@ class ActionsTest < Rails::Generators::TestCase test "route should add route" do run_generator - route_commands = ["get 'foo'", "get 'bar'", "get 'baz'"] + route_commands = ['get "foo"', 'get "bar"', 'get "baz"'] route_commands.each do |route_command| action :route, route_command end @@ -542,14 +542,14 @@ class ActionsTest < Rails::Generators::TestCase test "route should indent routing code" do run_generator - route_commands = ["get 'foo'", "get 'bar'", "get 'baz'"] + route_commands = ['get "foo"', 'get "bar"', 'get "baz"'] action :route, route_commands.join("\n") assert_routes route_commands end test "route should be idempotent" do run_generator - route_command = "root 'welcome#index'" + route_command = 'root "welcome#index"' # runs first time action :route, route_command diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb index a2f3d8fe4d..0c17ff9848 100644 --- a/railties/test/generators/api_app_generator_test.rb +++ b/railties/test/generators/api_app_generator_test.rb @@ -40,12 +40,12 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase end assert_file "Gemfile" do |content| - assert_no_match(/gem 'sass-rails'/, content) - assert_no_match(/gem 'web-console'/, content) - assert_no_match(/gem 'capybara'/, content) - assert_no_match(/gem 'selenium-webdriver'/, content) - assert_match(/# gem 'jbuilder'/, content) - assert_match(/# gem 'rack-cors'/, content) + assert_no_match(/gem "sass-rails"/, content) + assert_no_match(/gem "web-console"/, content) + assert_no_match(/gem "capybara"/, content) + assert_no_match(/gem "selenium-webdriver"/, content) + assert_match(/# gem "jbuilder"/, content) + assert_match(/# gem "rack-cors"/, content) end assert_file "config/application.rb", /config\.api_only = true/ diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c68e9ef4cf..a994dd8ee3 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -387,7 +387,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_gem_for_active_storage run_generator - assert_file "Gemfile", /^# gem 'image_processing'/ + assert_file "Gemfile", /^# gem "image_processing"/ end def test_gem_for_active_storage_when_skip_active_storage_is_given @@ -537,7 +537,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "activerecord-jdbcsqlite3-adapter" else - assert_gem "sqlite3", "'~> 1.4'" + assert_gem "sqlite3", '"~> 1.4"' end end @@ -547,7 +547,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "activerecord-jdbcmysql-adapter" else - assert_gem "mysql2", "'~> 0.5'" + assert_gem "mysql2", '"~> 0.5"' end end @@ -562,7 +562,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "activerecord-jdbcpostgresql-adapter" else - assert_gem "pg", "'~> 1.1'" + assert_gem "pg", '"~> 1.1"' end end @@ -601,7 +601,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_generator_defaults_to_puma_version run_generator [destination_root] - assert_gem "puma", "'~> 5.0'" + assert_gem "puma", '"~> 5.0"' end def test_generator_if_skip_puma_is_given @@ -618,7 +618,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_action_cable_redis_gems run_generator - assert_file "Gemfile", /^# gem 'redis'/ + assert_file "Gemfile", /^# gem "redis"/ end def test_generator_if_skip_test_is_given @@ -798,8 +798,8 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--dev", "--skip-bundle"] assert_file "Gemfile" do |content| - assert_match(/gem 'web-console',\s+github: 'rails\/web-console'/, content) - assert_no_match(/\Agem 'web-console', '>= 4\.1\.0'\z/, content) + assert_match(/gem "web-console",\s+github: "rails\/web-console"/, content) + assert_no_match(/\Agem "web-console", ">= 4\.1\.0"\z/, content) end end @@ -807,8 +807,8 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--edge"] assert_file "Gemfile" do |content| - assert_match(/gem 'web-console',\s+github: 'rails\/web-console'/, content) - assert_no_match(/\Agem 'web-console', '>= 4\.1\.0'\z/, content) + assert_match(/gem "web-console",\s+github: "rails\/web-console"/, content) + assert_no_match(/\Agem "web-console", ">= 4\.1\.0"\z/, content) end end @@ -816,8 +816,8 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--main"] assert_file "Gemfile" do |content| - assert_match(/gem 'web-console',\s+github: 'rails\/web-console'/, content) - assert_no_match(/\Agem 'web-console', '>= 4\.1\.0'\z/, content) + assert_match(/gem "web-console",\s+github: "rails\/web-console"/, content) + assert_no_match(/\Agem "web-console", ">= 4\.1\.0"\z/, content) end end @@ -1072,7 +1072,7 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator assert_file "Gemfile" do |content| - assert_match(/ruby '#{RUBY_VERSION}'/, content) + assert_match(/ruby "#{RUBY_VERSION}"/, content) end assert_file ".ruby-version" do |content| if ENV["RBENV_VERSION"] diff --git a/railties/test/generators/benchmark_generator_test.rb b/railties/test/generators/benchmark_generator_test.rb index 68e5546820..b9a801936f 100644 --- a/railties/test/generators/benchmark_generator_test.rb +++ b/railties/test/generators/benchmark_generator_test.rb @@ -16,7 +16,7 @@ module Rails run_generator ["my_benchmark"] assert_file("Gemfile") do |content| - assert_match "gem 'benchmark-ips'", content + assert_match "gem \"benchmark-ips\"", content end assert_file("script/benchmarks/my_benchmark.rb") do |content| @@ -77,7 +77,7 @@ module Rails run_generator ["my_benchmark"] assert_file("Gemfile") do |content| - occurrences = content.scan("gem 'benchmark-ips'").count + occurrences = content.scan("gem \"benchmark-ips\"").count assert_equal 1, occurrences, "Should only have benchmark-ips present once" end end diff --git a/railties/test/generators/db_system_change_generator_test.rb b/railties/test/generators/db_system_change_generator_test.rb index 943a6e874a..584e6e864c 100644 --- a/railties/test/generators/db_system_change_generator_test.rb +++ b/railties/test/generators/db_system_change_generator_test.rb @@ -40,7 +40,7 @@ module Rails assert_file("Gemfile") do |content| assert_match "# Use pg as the database for Active Record", content - assert_match "gem 'pg', '~> 1.1'", content + assert_match 'gem "pg", "~> 1.1"', content end end @@ -54,7 +54,7 @@ module Rails assert_file("Gemfile") do |content| assert_match "# Use mysql2 as the database for Active Record", content - assert_match "gem 'mysql2', '~> 0.5'", content + assert_match 'gem "mysql2", "~> 0.5"', content end end @@ -68,7 +68,7 @@ module Rails assert_file("Gemfile") do |content| assert_match "# Use sqlite3 as the database for Active Record", content - assert_match "gem 'sqlite3', '~> 1.4'", content + assert_match 'gem "sqlite3", "~> 1.4"', content end end @@ -83,7 +83,7 @@ module Rails assert_file("Gemfile") do |content| assert_match "# Use mysql2 as the database for Active Record", content - assert_match "gem 'mysql2', '~> 0.5'", content + assert_match 'gem "mysql2", "~> 0.5"', content end end end diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb index 827d539209..e9d02ce3d8 100644 --- a/railties/test/generators/model_generator_test.rb +++ b/railties/test/generators/model_generator_test.rb @@ -134,7 +134,7 @@ class ModelGeneratorTest < Rails::Generators::TestCase run_generator ["admin/account"] assert_file "app/models/admin.rb", /module Admin/ assert_file "app/models/admin.rb", /def self\.table_name_prefix/ - assert_file "app/models/admin.rb", /'admin_'/ + assert_file "app/models/admin.rb", /"admin_"/ assert_file "app/models/admin/account.rb", /class Admin::Account < ApplicationRecord/ end diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb index 6b9a53f226..3eaa68fd53 100644 --- a/railties/test/generators/namespaced_generators_test.rb +++ b/railties/test/generators/namespaced_generators_test.rb @@ -98,7 +98,7 @@ class NamespacedModelGeneratorTest < NamespacedGeneratorTestCase run_generator ["admin/account"] assert_file "app/models/test_app/admin.rb", /module TestApp/, /module Admin/ assert_file "app/models/test_app/admin.rb", /def self\.table_name_prefix/ - assert_file "app/models/test_app/admin.rb", /'test_app_admin_'/ + assert_file "app/models/test_app/admin.rb", /"test_app_admin_"/ assert_file "app/models/test_app/admin/account.rb", /module TestApp/, /class Admin::Account < ApplicationRecord/ end diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index a7c6c8b68a..a5010449d5 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -71,7 +71,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "test/test_helper.rb" do |content| assert_match(/require_relative.+test\/dummy\/config\/environment/, content) assert_match(/ActiveRecord::Migrator\.migrations_paths.+test\/dummy\/db\/migrate/, content) - assert_match(/Rails::TestUnitReporter\.executable = 'bin\/test'/, content) + assert_match(/Rails::TestUnitReporter\.executable = "bin\/test"/, content) end assert_file "lib/bukkits/railtie.rb", /module Bukkits\n class Railtie < ::Rails::Railtie\n end\nend/ assert_file "lib/bukkits.rb" do |content| @@ -152,7 +152,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_no_match(/byebug/, content) end else - assert_file "Gemfile", /# gem 'byebug'/ + assert_file "Gemfile", /# gem "byebug"/ end end @@ -396,7 +396,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "app/controllers/bukkits/application_controller.rb", /module Bukkits\n class ApplicationController < ActionController::Base/ assert_file "app/models/bukkits/application_record.rb", /module Bukkits\n class ApplicationRecord < ActiveRecord::Base/ assert_file "app/jobs/bukkits/application_job.rb", /module Bukkits\n class ApplicationJob < ActiveJob::Base/ - assert_file "app/mailers/bukkits/application_mailer.rb", /module Bukkits\n class ApplicationMailer < ActionMailer::Base\n default from: 'from@example\.com'\n layout 'mailer'\n/ + assert_file "app/mailers/bukkits/application_mailer.rb", /module Bukkits\n class ApplicationMailer < ActionMailer::Base\n default from: "from@example\.com"\n layout "mailer"\n/ assert_file "app/helpers/bukkits/application_helper.rb", /module Bukkits\n module ApplicationHelper/ assert_file "app/views/layouts/bukkits/application.html.erb" do |contents| assert_match "Bukkits", contents @@ -410,7 +410,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_match(/ActiveRecord::Migrator\.migrations_paths.+\.\.\/test\/dummy\/db\/migrate/, content) assert_match(/ActiveRecord::Migrator\.migrations_paths.+<<.+\.\.\/db\/migrate/, content) assert_match(/ActionDispatch::IntegrationTest\.fixture_path = ActiveSupport::TestCase\.fixture_pat/, content) - assert_no_match(/Rails::TestUnitReporter\.executable = 'bin\/test'/, content) + assert_no_match(/Rails::TestUnitReporter\.executable = "bin\/test"/, content) end assert_no_file "bin/test" end @@ -421,14 +421,14 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "hyphenated-name/app/assets/stylesheets/hyphenated/name" assert_file "hyphenated-name/app/assets/images/hyphenated/name" assert_file "hyphenated-name/config/routes.rb", /Hyphenated::Name::Engine\.routes\.draw do/ - assert_file "hyphenated-name/lib/hyphenated/name/version.rb", /module Hyphenated\n module Name\n VERSION = '0\.1\.0'\n end\nend/ + assert_file "hyphenated-name/lib/hyphenated/name/version.rb", /module Hyphenated\n module Name\n VERSION = "0\.1\.0"\n end\nend/ assert_file "hyphenated-name/lib/hyphenated/name/engine.rb", /module Hyphenated\n module Name\n class Engine < ::Rails::Engine\n isolate_namespace Hyphenated::Name\n end\n end\nend/ assert_file "hyphenated-name/lib/hyphenated/name.rb", /require "hyphenated\/name\/engine"/ assert_file "hyphenated-name/test/dummy/config/routes.rb", /mount Hyphenated::Name::Engine => "\/hyphenated-name"/ assert_file "hyphenated-name/app/controllers/hyphenated/name/application_controller.rb", /module Hyphenated\n module Name\n class ApplicationController < ActionController::Base\n end\n end\nend\n/ assert_file "hyphenated-name/app/models/hyphenated/name/application_record.rb", /module Hyphenated\n module Name\n class ApplicationRecord < ActiveRecord::Base\n primary_abstract_class\n end\n end\nend/ assert_file "hyphenated-name/app/jobs/hyphenated/name/application_job.rb", /module Hyphenated\n module Name\n class ApplicationJob < ActiveJob::Base/ - assert_file "hyphenated-name/app/mailers/hyphenated/name/application_mailer.rb", /module Hyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: 'from@example\.com'\n layout 'mailer'\n end\n end\nend/ + assert_file "hyphenated-name/app/mailers/hyphenated/name/application_mailer.rb", /module Hyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: "from@example\.com"\n layout "mailer"\n end\n end\nend/ assert_file "hyphenated-name/app/helpers/hyphenated/name/application_helper.rb", /module Hyphenated\n module Name\n module ApplicationHelper\n end\n end\nend/ assert_file "hyphenated-name/app/views/layouts/hyphenated/name/application.html.erb" do |contents| assert_match "Hyphenated name", contents @@ -443,18 +443,18 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "my_hyphenated-name/app/assets/stylesheets/my_hyphenated/name" assert_file "my_hyphenated-name/app/assets/images/my_hyphenated/name" assert_file "my_hyphenated-name/config/routes.rb", /MyHyphenated::Name::Engine\.routes\.draw do/ - assert_file "my_hyphenated-name/lib/my_hyphenated/name/version.rb", /module MyHyphenated\n module Name\n VERSION = '0\.1\.0'\n end\nend/ + assert_file "my_hyphenated-name/lib/my_hyphenated/name/version.rb", /module MyHyphenated\n module Name\n VERSION = "0\.1\.0"\n end\nend/ assert_file "my_hyphenated-name/lib/my_hyphenated/name/engine.rb", /module MyHyphenated\n module Name\n class Engine < ::Rails::Engine\n isolate_namespace MyHyphenated::Name\n end\n end\nend/ assert_file "my_hyphenated-name/lib/my_hyphenated/name.rb", /require "my_hyphenated\/name\/engine"/ assert_file "my_hyphenated-name/test/dummy/config/routes.rb", /mount MyHyphenated::Name::Engine => "\/my_hyphenated-name"/ assert_file "my_hyphenated-name/app/controllers/my_hyphenated/name/application_controller.rb", /module MyHyphenated\n module Name\n class ApplicationController < ActionController::Base\n end\n end\nend\n/ assert_file "my_hyphenated-name/app/models/my_hyphenated/name/application_record.rb", /module MyHyphenated\n module Name\n class ApplicationRecord < ActiveRecord::Base\n primary_abstract_class\n end\n end\nend/ assert_file "my_hyphenated-name/app/jobs/my_hyphenated/name/application_job.rb", /module MyHyphenated\n module Name\n class ApplicationJob < ActiveJob::Base/ - assert_file "my_hyphenated-name/app/mailers/my_hyphenated/name/application_mailer.rb", /module MyHyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: 'from@example\.com'\n layout 'mailer'\n end\n end\nend/ + assert_file "my_hyphenated-name/app/mailers/my_hyphenated/name/application_mailer.rb", /module MyHyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: "from@example\.com"\n layout "mailer"\n end\n end\nend/ assert_file "my_hyphenated-name/app/helpers/my_hyphenated/name/application_helper.rb", /module MyHyphenated\n module Name\n module ApplicationHelper\n end\n end\nend/ assert_file "my_hyphenated-name/app/views/layouts/my_hyphenated/name/application.html.erb" do |contents| assert_match "My hyphenated name", contents - assert_match(/stylesheet_link_tag\s+['"]my_hyphenated\/name\/application['"]/, contents) + assert_match(/stylesheet_link_tag\s+[""]my_hyphenated\/name\/application['"]/, contents) assert_no_match(/javascript_include_tag\s+['"]my_hyphenated\/name\/application['"]/, contents) end end @@ -465,14 +465,14 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_file "deep-hyphenated-name/app/assets/stylesheets/deep/hyphenated/name" assert_file "deep-hyphenated-name/app/assets/images/deep/hyphenated/name" assert_file "deep-hyphenated-name/config/routes.rb", /Deep::Hyphenated::Name::Engine\.routes\.draw do/ - assert_file "deep-hyphenated-name/lib/deep/hyphenated/name/version.rb", /module Deep\n module Hyphenated\n module Name\n VERSION = '0\.1\.0'\n end\n end\nend/ + assert_file "deep-hyphenated-name/lib/deep/hyphenated/name/version.rb", /module Deep\n module Hyphenated\n module Name\n VERSION = "0\.1\.0"\n end\n end\nend/ assert_file "deep-hyphenated-name/lib/deep/hyphenated/name/engine.rb", /module Deep\n module Hyphenated\n module Name\n class Engine < ::Rails::Engine\n isolate_namespace Deep::Hyphenated::Name\n end\n end\n end\nend/ assert_file "deep-hyphenated-name/lib/deep/hyphenated/name.rb", /require "deep\/hyphenated\/name\/engine"/ assert_file "deep-hyphenated-name/test/dummy/config/routes.rb", /mount Deep::Hyphenated::Name::Engine => "\/deep-hyphenated-name"/ assert_file "deep-hyphenated-name/app/controllers/deep/hyphenated/name/application_controller.rb", /module Deep\n module Hyphenated\n module Name\n class ApplicationController < ActionController::Base\n end\n end\n end\nend\n/ assert_file "deep-hyphenated-name/app/models/deep/hyphenated/name/application_record.rb", /module Deep\n module Hyphenated\n module Name\n class ApplicationRecord < ActiveRecord::Base\n primary_abstract_class\n end\n end\n end\nend/ assert_file "deep-hyphenated-name/app/jobs/deep/hyphenated/name/application_job.rb", /module Deep\n module Hyphenated\n module Name\n class ApplicationJob < ActiveJob::Base/ - assert_file "deep-hyphenated-name/app/mailers/deep/hyphenated/name/application_mailer.rb", /module Deep\n module Hyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: 'from@example\.com'\n layout 'mailer'\n end\n end\n end\nend/ + assert_file "deep-hyphenated-name/app/mailers/deep/hyphenated/name/application_mailer.rb", /module Deep\n module Hyphenated\n module Name\n class ApplicationMailer < ActionMailer::Base\n default from: "from@example\.com"\n layout "mailer"\n end\n end\n end\nend/ assert_file "deep-hyphenated-name/app/helpers/deep/hyphenated/name/application_helper.rb", /module Deep\n module Hyphenated\n module Name\n module ApplicationHelper\n end\n end\n end\nend/ assert_file "deep-hyphenated-name/app/views/layouts/deep/hyphenated/name/application.html.erb" do |contents| assert_match "Deep hyphenated name", contents @@ -652,7 +652,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_no_file "bukkits.gemspec" assert_file "Gemfile" do |contents| assert_no_match("gemspec", contents) - assert_match(/gem 'rails'/, contents) + assert_match(/gem "rails"/, contents) end end @@ -661,7 +661,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase assert_no_file "bukkits.gemspec" assert_file "Gemfile" do |contents| assert_no_match("gemspec", contents) - assert_match(/gem 'rails'/, contents) + assert_match(/gem "rails"/, contents) end end @@ -885,7 +885,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_match(/group :development do\n gem 'activerecord-jdbcsqlite3-adapter'\nend/, contents) else - assert_match(/group :development do\n gem 'sqlite3'\nend/, contents) + assert_match(/group :development do\n gem "sqlite3"\nend/, contents) end end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 6d374e85e8..a323e3aa10 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -570,17 +570,17 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end assert_file "test/controllers/users_controller_test.rb" do |content| - assert_match(/password: 'secret'/, content) - assert_match(/password_confirmation: 'secret'/, content) + assert_match(/password: "secret"/, content) + assert_match(/password_confirmation: "secret"/, content) end assert_file "test/system/users_test.rb" do |content| - assert_match(/fill_in "Password", with: 'secret'/, content) - assert_match(/fill_in "Password confirmation", with: 'secret'/, content) + assert_match(/fill_in "Password", with: "secret"/, content) + assert_match(/fill_in "Password confirmation", with: "secret"/, content) end assert_file "test/fixtures/users.yml" do |content| - assert_match(/password_digest: <%= BCrypt::Password.create\('secret'\) %>/, content) + assert_match(/password_digest: <%= BCrypt::Password.create\("secret"\) %>/, content) end end diff --git a/railties/test/railties/generators_test.rb b/railties/test/railties/generators_test.rb index 8383cb3050..51694a7d9b 100644 --- a/railties/test/railties/generators_test.rb +++ b/railties/test/railties/generators_test.rb @@ -79,7 +79,7 @@ module RailtiesTests bundled_rails("g model namespaced/topic") assert_file "app/models/foo_bar/namespaced.rb", /module FooBar\n module Namespaced/ do |content| assert_class_method :table_name_prefix, content do |method_content| - assert_match(/'foo_bar_namespaced_'/, method_content) + assert_match(/"foo_bar_namespaced_"/, method_content) end end end