Used double quotes in template file for consistency.

This commit is contained in:
Ashik Salman 2021-04-24 23:16:43 +05:30
parent e0d2459401
commit 68a9d6367e
47 changed files with 178 additions and 178 deletions

View File

@ -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 %>

View File

@ -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 -%>

View File

@ -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

View File

@ -257,7 +257,7 @@ module Rails
version = super
if version.is_a?(Array)
version.join("', '")
version.join('", "')
else
version
end

View File

@ -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

View File

@ -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]

View File

@ -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"] %>

View File

@ -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"] %>

View File

@ -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"] %>

View File

@ -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

View File

@ -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"] %>

View File

@ -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"] %>

View File

@ -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"] %>

View File

@ -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

View File

@ -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"] %>

View File

@ -2,7 +2,7 @@
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# http_host: "example.org",
# https: false
# )
# end

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 -%>

View File

@ -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:

View File

@ -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
%>

View File

@ -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
%>

View File

@ -1 +1 @@
<%= wrap_in_modules "VERSION = '0.1.0'" %>
<%= wrap_in_modules 'VERSION = "0.1.0"' %>

View File

@ -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__)

View File

@ -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] -%>

View File

@ -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

View File

@ -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: {}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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/

View File

@ -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"]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "<title>Bukkits</title>", 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 "<title>Hyphenated name</title>", 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 "<title>My hyphenated name</title>", 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 "<title>Deep hyphenated name</title>", 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

View File

@ -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

View File

@ -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