aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:55:02 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 20:16:27 +0200
commit80e66cc4d90bf8c15d1a5f6e3152e90147f00772 (patch)
treee7e75464af04f3cf1935b29238dbd7cb2337b0dd /railties
parent411ccbdab2608c62aabdb320d52cb02d446bb39c (diff)
downloadrails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.tar.gz
rails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.tar.bz2
rails-80e66cc4d90bf8c15d1a5f6e3152e90147f00772.zip
normalizes indentation and whitespace across the project
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application.rb18
-rw-r--r--railties/lib/rails/application_controller.rb14
-rw-r--r--railties/lib/rails/commands/console_helper.rb6
-rw-r--r--railties/lib/rails/commands/dbconsole.rb2
-rw-r--r--railties/lib/rails/commands/plugin.rb2
-rw-r--r--railties/lib/rails/commands/runner.rb14
-rw-r--r--railties/lib/rails/commands/server.rb48
-rw-r--r--railties/lib/rails/engine.rb84
-rw-r--r--railties/lib/rails/generators/actions/create_migration.rb42
-rw-r--r--railties/lib/rails/generators/erb.rb24
-rw-r--r--railties/lib/rails/generators/erb/mailer/mailer_generator.rb12
-rw-r--r--railties/lib/rails/generators/rails/assets/assets_generator.rb18
-rw-r--r--railties/lib/rails/info.rb2
-rw-r--r--railties/lib/rails/info_controller.rb16
-rw-r--r--railties/lib/rails/rack/logger.rb14
-rw-r--r--railties/lib/rails/railtie.rb38
-rw-r--r--railties/lib/rails/railtie/configurable.rb6
-rw-r--r--railties/lib/rails/tasks/annotations.rake2
-rw-r--r--railties/lib/rails/tasks/log.rake8
-rw-r--r--railties/lib/rails/test_unit/testing.rake2
-rw-r--r--railties/test/application/assets_test.rb12
-rw-r--r--railties/test/application/loading_test.rb14
-rw-r--r--railties/test/application/middleware/static_test.rb4
-rw-r--r--railties/test/application/rake/migrations_test.rb72
-rw-r--r--railties/test/application/rake/notes_test.rb34
-rw-r--r--railties/test/commands/console_test.rb50
-rw-r--r--railties/test/commands/dbconsole_test.rb50
-rw-r--r--railties/test/configuration/middleware_stack_proxy_test.rb12
-rw-r--r--railties/test/env_helpers.rb36
-rw-r--r--railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb2
-rw-r--r--railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb2
-rw-r--r--railties/test/fixtures/lib/generators/model_generator.rb2
-rw-r--r--railties/test/generators/api_app_generator_test.rb90
-rw-r--r--railties/test/generators/app_generator_test.rb2
-rw-r--r--railties/test/generators/model_generator_test.rb14
-rw-r--r--railties/test/railties/mounted_engine_test.rb6
-rw-r--r--railties/test/test_unit/reporter_test.rb60
37 files changed, 417 insertions, 417 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 6178147ee4..9c150965bf 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -522,15 +522,15 @@ module Rails
private
- def build_request(env)
- req = super
- env["ORIGINAL_FULLPATH"] = req.fullpath
- env["ORIGINAL_SCRIPT_NAME"] = req.script_name
- req
- end
+ def build_request(env)
+ req = super
+ env["ORIGINAL_FULLPATH"] = req.fullpath
+ env["ORIGINAL_SCRIPT_NAME"] = req.script_name
+ req
+ end
- def build_middleware
- config.app_middleware + super
- end
+ def build_middleware
+ config.app_middleware + super
+ end
end
end
diff --git a/railties/lib/rails/application_controller.rb b/railties/lib/rails/application_controller.rb
index b0f3c3946d..f8394b8e0a 100644
--- a/railties/lib/rails/application_controller.rb
+++ b/railties/lib/rails/application_controller.rb
@@ -4,13 +4,13 @@ class Rails::ApplicationController < ActionController::Base # :nodoc:
protected
- def require_local!
- unless local_request?
- render html: "<p>For security purposes, this information is only available to local requests.</p>".html_safe, status: :forbidden
+ def require_local!
+ unless local_request?
+ render html: "<p>For security purposes, this information is only available to local requests.</p>".html_safe, status: :forbidden
+ end
end
- end
- def local_request?
- Rails.application.config.consider_all_requests_local || request.local?
- end
+ def local_request?
+ Rails.application.config.consider_all_requests_local || request.local?
+ end
end
diff --git a/railties/lib/rails/commands/console_helper.rb b/railties/lib/rails/commands/console_helper.rb
index 48c489740e..0b7f1c4249 100644
--- a/railties/lib/rails/commands/console_helper.rb
+++ b/railties/lib/rails/commands/console_helper.rb
@@ -8,7 +8,7 @@ module Rails
def start(*args)
new(*args).start
end
-
+
private
def set_options_env(arguments, options)
if arguments.first && arguments.first[0] != "-"
@@ -24,11 +24,11 @@ module Rails
def available_environments
Dir["config/environments/*.rb"].map { |fname| File.basename(fname, ".*") }
- end
+ end
end
def environment
ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
end
end
-end \ No newline at end of file
+end
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb
index 95cd1fe528..d79a88b025 100644
--- a/railties/lib/rails/commands/dbconsole.rb
+++ b/railties/lib/rails/commands/dbconsole.rb
@@ -21,7 +21,7 @@ module Rails
opt.on("--mode [MODE]", ["html", "list", "line", "column"],
"Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode|
- options["mode"] = mode
+ options["mode"] = mode
end
opt.on("--header") do |h|
diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb
index ee5abdf880..6404748fca 100644
--- a/railties/lib/rails/commands/plugin.rb
+++ b/railties/lib/rails/commands/plugin.rb
@@ -5,7 +5,7 @@ else
unless ARGV.delete("--no-rc")
customrc = ARGV.index{ |x| x.include?("--rc=") }
railsrc = if customrc
- File.expand_path(ARGV.delete_at(customrc).gsub(/--rc=/, ""))
+ File.expand_path(ARGV.delete_at(customrc).gsub(/--rc=/, ""))
else
File.join(File.expand_path("~"), ".railsrc")
end
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb
index 38c749151c..11ef1d10e2 100644
--- a/railties/lib/rails/commands/runner.rb
+++ b/railties/lib/rails/commands/runner.rb
@@ -22,14 +22,14 @@ ARGV.clone.options do |opts|
opts.on("-h", "--help",
"Show this help message.") { $stdout.puts opts; exit }
- opts.separator ""
- opts.separator "Examples: "
+ opts.separator ""
+ opts.separator "Examples: "
- opts.separator " rails runner 'puts Rails.env'"
- opts.separator " This runs the code `puts Rails.env` after loading the app"
- opts.separator ""
- opts.separator " rails runner path/to/filename.rb"
- opts.separator " This runs the Ruby file located at `path/to/filename.rb` after loading the app"
+ opts.separator " rails runner 'puts Rails.env'"
+ opts.separator " This runs the code `puts Rails.env` after loading the app"
+ opts.separator ""
+ opts.separator " rails runner path/to/filename.rb"
+ opts.separator " This runs the Ruby file located at `path/to/filename.rb` after loading the app"
if RbConfig::CONFIG["host_os"] !~ /mswin|mingw/
opts.separator ""
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index 28941fd704..bf8ae0a5ee 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -21,31 +21,31 @@ module Rails
private
- def option_parser(options)
- OptionParser.new do |opts|
- opts.banner = "Usage: rails server [mongrel, thin etc] [options]"
- opts.on("-p", "--port=port", Integer,
- "Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v }
- opts.on("-b", "--binding=IP", String,
- "Binds Rails to the specified IP.", "Default: localhost") { |v| options[:Host] = v }
- opts.on("-c", "--config=file", String,
- "Uses a custom rackup configuration.") { |v| options[:config] = v }
- opts.on("-d", "--daemon", "Runs server as a Daemon.") { options[:daemonize] = true }
- opts.on("-e", "--environment=name", String,
- "Specifies the environment to run this server under (test/development/production).",
- "Default: development") { |v| options[:environment] = v }
- opts.on("-P", "--pid=pid", String,
- "Specifies the PID file.",
- "Default: tmp/pids/server.pid") { |v| options[:pid] = v }
- opts.on("-C", "--[no-]dev-caching",
- "Specifies whether to perform caching in development.",
- "true or false") { |v| options[:caching] = v }
-
- opts.separator ""
-
- opts.on("-h", "--help", "Shows this help message.") { puts opts; exit }
+ def option_parser(options)
+ OptionParser.new do |opts|
+ opts.banner = "Usage: rails server [mongrel, thin etc] [options]"
+ opts.on("-p", "--port=port", Integer,
+ "Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v }
+ opts.on("-b", "--binding=IP", String,
+ "Binds Rails to the specified IP.", "Default: localhost") { |v| options[:Host] = v }
+ opts.on("-c", "--config=file", String,
+ "Uses a custom rackup configuration.") { |v| options[:config] = v }
+ opts.on("-d", "--daemon", "Runs server as a Daemon.") { options[:daemonize] = true }
+ opts.on("-e", "--environment=name", String,
+ "Specifies the environment to run this server under (test/development/production).",
+ "Default: development") { |v| options[:environment] = v }
+ opts.on("-P", "--pid=pid", String,
+ "Specifies the PID file.",
+ "Default: tmp/pids/server.pid") { |v| options[:pid] = v }
+ opts.on("-C", "--[no-]dev-caching",
+ "Specifies whether to perform caching in development.",
+ "true or false") { |v| options[:caching] = v }
+
+ opts.separator ""
+
+ opts.on("-h", "--help", "Shows this help message.") { puts opts; exit }
+ end
end
- end
end
def initialize(*)
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index b8a9cac6d0..bcd1a66921 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -643,62 +643,62 @@ module Rails
protected
- def load_config_initializer(initializer)
- ActiveSupport::Notifications.instrument("load_config_initializer.railties", initializer: initializer) do
- load(initializer)
+ def load_config_initializer(initializer)
+ ActiveSupport::Notifications.instrument("load_config_initializer.railties", initializer: initializer) do
+ load(initializer)
+ end
end
- end
- def run_tasks_blocks(*) #:nodoc:
- super
- paths["lib/tasks"].existent.sort.each { |ext| load(ext) }
- end
+ def run_tasks_blocks(*) #:nodoc:
+ super
+ paths["lib/tasks"].existent.sort.each { |ext| load(ext) }
+ end
- def has_migrations? #:nodoc:
- paths["db/migrate"].existent.any?
- end
+ def has_migrations? #:nodoc:
+ paths["db/migrate"].existent.any?
+ end
- def self.find_root_with_flag(flag, root_path, default=nil) #:nodoc:
+ def self.find_root_with_flag(flag, root_path, default=nil) #:nodoc:
- while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
- parent = File.dirname(root_path)
- root_path = parent != root_path && parent
- end
+ while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
+ parent = File.dirname(root_path)
+ root_path = parent != root_path && parent
+ end
- root = File.exist?("#{root_path}/#{flag}") ? root_path : default
- raise "Could not find root path for #{self}" unless root
+ root = File.exist?("#{root_path}/#{flag}") ? root_path : default
+ raise "Could not find root path for #{self}" unless root
- Pathname.new File.realpath root
- end
+ Pathname.new File.realpath root
+ end
- def default_middleware_stack #:nodoc:
- ActionDispatch::MiddlewareStack.new
- end
+ def default_middleware_stack #:nodoc:
+ ActionDispatch::MiddlewareStack.new
+ end
- def _all_autoload_once_paths #:nodoc:
- config.autoload_once_paths
- end
+ def _all_autoload_once_paths #:nodoc:
+ config.autoload_once_paths
+ end
- def _all_autoload_paths #:nodoc:
- @_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
- end
+ def _all_autoload_paths #:nodoc:
+ @_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
+ end
- def _all_load_paths #:nodoc:
- @_all_load_paths ||= (config.paths.load_paths + _all_autoload_paths).uniq
- end
+ def _all_load_paths #:nodoc:
+ @_all_load_paths ||= (config.paths.load_paths + _all_autoload_paths).uniq
+ end
private
- def build_request(env)
- env.merge!(env_config)
- req = ActionDispatch::Request.new env
- req.routes = routes
- req.engine_script_name = req.script_name
- req
- end
+ def build_request(env)
+ env.merge!(env_config)
+ req = ActionDispatch::Request.new env
+ req.routes = routes
+ req.engine_script_name = req.script_name
+ req
+ end
- def build_middleware
- config.middleware
- end
+ def build_middleware
+ config.middleware
+ end
end
end
diff --git a/railties/lib/rails/generators/actions/create_migration.rb b/railties/lib/rails/generators/actions/create_migration.rb
index a5e624b5d1..46f376a38e 100644
--- a/railties/lib/rails/generators/actions/create_migration.rb
+++ b/railties/lib/rails/generators/actions/create_migration.rb
@@ -40,30 +40,30 @@ module Rails
protected
- def on_conflict_behavior
- options = base.options.merge(config)
- if identical?
- say_status :identical, :blue, relative_existing_migration
- elsif options[:force]
- say_status :remove, :green, relative_existing_migration
- say_status :create, :green
- unless pretend?
- ::FileUtils.rm_rf(existing_migration)
- yield
+ def on_conflict_behavior
+ options = base.options.merge(config)
+ if identical?
+ say_status :identical, :blue, relative_existing_migration
+ elsif options[:force]
+ say_status :remove, :green, relative_existing_migration
+ say_status :create, :green
+ unless pretend?
+ ::FileUtils.rm_rf(existing_migration)
+ yield
+ end
+ elsif options[:skip]
+ say_status :skip, :yellow
+ else
+ say_status :conflict, :red
+ raise Error, "Another migration is already named #{migration_file_name}: " +
+ "#{existing_migration}. Use --force to replace this migration " +
+ "or --skip to ignore conflicted file."
end
- elsif options[:skip]
- say_status :skip, :yellow
- else
- say_status :conflict, :red
- raise Error, "Another migration is already named #{migration_file_name}: " +
- "#{existing_migration}. Use --force to replace this migration " +
- "or --skip to ignore conflicted file."
end
- end
- def say_status(status, color, message = relative_destination)
- base.shell.say_status(status, message, color) if config[:verbose]
- end
+ def say_status(status, color, message = relative_destination)
+ base.shell.say_status(status, message, color) if config[:verbose]
+ end
end
end
end
diff --git a/railties/lib/rails/generators/erb.rb b/railties/lib/rails/generators/erb.rb
index 99d8a0b786..d01502002f 100644
--- a/railties/lib/rails/generators/erb.rb
+++ b/railties/lib/rails/generators/erb.rb
@@ -5,21 +5,21 @@ module Erb # :nodoc:
class Base < Rails::Generators::NamedBase #:nodoc:
protected
- def formats
- [format]
- end
+ def formats
+ [format]
+ end
- def format
- :html
- end
+ def format
+ :html
+ end
- def handler
- :erb
- end
+ def handler
+ :erb
+ end
- def filename_with_extensions(name, format = self.format)
- [name, format, handler].compact.join(".")
- end
+ def filename_with_extensions(name, format = self.format)
+ [name, format, handler].compact.join(".")
+ end
end
end
end
diff --git a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
index 1207cdad69..f150240908 100644
--- a/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
+++ b/railties/lib/rails/generators/erb/mailer/mailer_generator.rb
@@ -28,13 +28,13 @@ module Erb # :nodoc:
protected
- def formats
- [:text, :html]
- end
+ def formats
+ [:text, :html]
+ end
- def file_name
- @_file_name ||= super.gsub(/_mailer/i, "")
- end
+ def file_name
+ @_file_name ||= super.gsub(/_mailer/i, "")
+ end
end
end
end
diff --git a/railties/lib/rails/generators/rails/assets/assets_generator.rb b/railties/lib/rails/generators/rails/assets/assets_generator.rb
index 6f4b86e708..265dada2ca 100644
--- a/railties/lib/rails/generators/rails/assets/assets_generator.rb
+++ b/railties/lib/rails/generators/rails/assets/assets_generator.rb
@@ -9,17 +9,17 @@ module Rails
protected
- def asset_name
- file_name
- end
+ def asset_name
+ file_name
+ end
- hook_for :javascript_engine do |javascript_engine|
- invoke javascript_engine, [name] if options[:javascripts]
- end
+ hook_for :javascript_engine do |javascript_engine|
+ invoke javascript_engine, [name] if options[:javascripts]
+ end
- hook_for :stylesheet_engine do |stylesheet_engine|
- invoke stylesheet_engine, [name] if options[:stylesheets]
- end
+ hook_for :stylesheet_engine do |stylesheet_engine|
+ invoke stylesheet_engine, [name] if options[:stylesheets]
+ end
end
end
end
diff --git a/railties/lib/rails/info.rb b/railties/lib/rails/info.rb
index 5cc747592d..d69cbbc001 100644
--- a/railties/lib/rails/info.rb
+++ b/railties/lib/rails/info.rb
@@ -42,7 +42,7 @@ module Rails
properties.each do |(name, value)|
table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
formatted_value = if value.kind_of?(Array)
- "<ul>" + value.map { |v| "<li>#{CGI.escapeHTML(v.to_s)}</li>" }.join + "</ul>"
+ "<ul>" + value.map { |v| "<li>#{CGI.escapeHTML(v.to_s)}</li>" }.join + "</ul>"
else
CGI.escapeHTML(value.to_s)
end
diff --git a/railties/lib/rails/info_controller.rb b/railties/lib/rails/info_controller.rb
index db9a32c9c2..f5aa074703 100644
--- a/railties/lib/rails/info_controller.rb
+++ b/railties/lib/rails/info_controller.rb
@@ -32,13 +32,13 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
private
- def match_route
- _routes.routes.select {|route|
- yield route.path
- }.map {|route| route.path.spec.to_s }
- end
+ def match_route
+ _routes.routes.select {|route|
+ yield route.path
+ }.map {|route| route.path.spec.to_s }
+ end
- def with_leading_slash(path)
- ("/" + path).squeeze("/")
- end
+ def with_leading_slash(path)
+ ("/" + path).squeeze("/")
+ end
end
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb
index b8684971fc..e3fee75603 100644
--- a/railties/lib/rails/rack/logger.rb
+++ b/railties/lib/rails/rack/logger.rb
@@ -67,14 +67,14 @@ module Rails
private
- def finish(request)
- instrumenter = ActiveSupport::Notifications.instrumenter
- instrumenter.finish "request.action_dispatch", request: request
- end
+ def finish(request)
+ instrumenter = ActiveSupport::Notifications.instrumenter
+ instrumenter.finish "request.action_dispatch", request: request
+ end
- def logger
- Rails.logger
- end
+ def logger
+ Rails.logger
+ end
end
end
end
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index 8718f6db2d..eb3f5d4ee9 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -222,31 +222,31 @@ module Rails
protected
- def run_console_blocks(app) #:nodoc:
- each_registered_block(:console) { |block| block.call(app) }
- end
+ def run_console_blocks(app) #:nodoc:
+ each_registered_block(:console) { |block| block.call(app) }
+ end
- def run_generators_blocks(app) #:nodoc:
- each_registered_block(:generators) { |block| block.call(app) }
- end
+ def run_generators_blocks(app) #:nodoc:
+ each_registered_block(:generators) { |block| block.call(app) }
+ end
- def run_runner_blocks(app) #:nodoc:
- each_registered_block(:runner) { |block| block.call(app) }
- end
+ def run_runner_blocks(app) #:nodoc:
+ each_registered_block(:runner) { |block| block.call(app) }
+ end
- def run_tasks_blocks(app) #:nodoc:
- extend Rake::DSL
- each_registered_block(:rake_tasks) { |block| instance_exec(app, &block) }
- end
+ def run_tasks_blocks(app) #:nodoc:
+ extend Rake::DSL
+ each_registered_block(:rake_tasks) { |block| instance_exec(app, &block) }
+ end
private
- def each_registered_block(type, &block)
- klass = self.class
- while klass.respond_to?(type)
- klass.public_send(type).each(&block)
- klass = klass.superclass
+ def each_registered_block(type, &block)
+ klass = self.class
+ while klass.respond_to?(type)
+ klass.public_send(type).each(&block)
+ klass = klass.superclass
+ end
end
- end
end
end
diff --git a/railties/lib/rails/railtie/configurable.rb b/railties/lib/rails/railtie/configurable.rb
index 257c4df894..d6040785a0 100644
--- a/railties/lib/rails/railtie/configurable.rb
+++ b/railties/lib/rails/railtie/configurable.rb
@@ -26,9 +26,9 @@ module Rails
protected
- def method_missing(*args, &block)
- instance.send(*args, &block)
- end
+ def method_missing(*args, &block)
+ instance.send(*args, &block)
+ end
end
end
end
diff --git a/railties/lib/rails/tasks/annotations.rake b/railties/lib/rails/tasks/annotations.rake
index 61dd4a1a37..9a69eb9934 100644
--- a/railties/lib/rails/tasks/annotations.rake
+++ b/railties/lib/rails/tasks/annotations.rake
@@ -17,4 +17,4 @@ namespace :notes do
task :custom do
SourceAnnotationExtractor.enumerate ENV["ANNOTATION"]
end
-end \ No newline at end of file
+end
diff --git a/railties/lib/rails/tasks/log.rake b/railties/lib/rails/tasks/log.rake
index 31acbdcb84..c376234fee 100644
--- a/railties/lib/rails/tasks/log.rake
+++ b/railties/lib/rails/tasks/log.rake
@@ -1,8 +1,8 @@
namespace :log do
-
- ##
+
+ ##
# Truncates all/specified log files
- # ENV['LOGS']
+ # ENV['LOGS']
# - defaults to standard environment log files i.e. 'development,test,production'
# - ENV['LOGS']=all truncates all files i.e. log/*.log
# - ENV['LOGS']='test,development' truncates only specified files
@@ -28,7 +28,7 @@ namespace :log do
.map { |file| "log/#{file.strip}.log" }
.select { |file| File.exist?(file) }
end
-
+
def clear_log_file(file)
f = File.open(file, "w")
f.close
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index d172106302..91ff7f4be7 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -8,7 +8,7 @@ desc "Runs all tests in test folder"
task :test do
$: << "test"
pattern = if ENV.key?("TEST")
- ENV["TEST"]
+ ENV["TEST"]
else
"test"
end
diff --git a/railties/test/application/assets_test.rb b/railties/test/application/assets_test.rb
index 9396e2cff7..e84e01a41b 100644
--- a/railties/test/application/assets_test.rb
+++ b/railties/test/application/assets_test.rb
@@ -507,16 +507,16 @@ module ApplicationTests
private
- def app_with_assets_in_view
- app_file "app/assets/javascripts/application.js", "//= require_tree ."
- app_file "app/assets/javascripts/xmlhr.js", "function f1() { alert(); }"
- app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
+ def app_with_assets_in_view
+ app_file "app/assets/javascripts/application.js", "//= require_tree ."
+ app_file "app/assets/javascripts/xmlhr.js", "function f1() { alert(); }"
+ app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
- app_file "config/routes.rb", <<-RUBY
+ app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do
get '/posts', :to => "posts#index"
end
RUBY
- end
+ end
end
end
diff --git a/railties/test/application/loading_test.rb b/railties/test/application/loading_test.rb
index 18f8c89790..d57384d256 100644
--- a/railties/test/application/loading_test.rb
+++ b/railties/test/application/loading_test.rb
@@ -359,13 +359,13 @@ class LoadingTest < ActiveSupport::TestCase
protected
- def setup_ar!
- ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
- ActiveRecord::Migration.verbose = false
- ActiveRecord::Schema.define(version: 1) do
- create_table :posts do |t|
- t.string :title
+ def setup_ar!
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
+ ActiveRecord::Migration.verbose = false
+ ActiveRecord::Schema.define(version: 1) do
+ create_table :posts do |t|
+ t.string :title
+ end
end
end
- end
end
diff --git a/railties/test/application/middleware/static_test.rb b/railties/test/application/middleware/static_test.rb
index 8a06e91297..5cd3e4325e 100644
--- a/railties/test/application/middleware/static_test.rb
+++ b/railties/test/application/middleware/static_test.rb
@@ -46,11 +46,11 @@ module ApplicationTests
test "public_file_server.index_name defaults to 'index'" do
app_file "public/index.html", "/index.html"
-
+
require "#{app_path}/config/environment"
get "/"
-
+
assert_equal "/index.html\n", last_response.body
end
diff --git a/railties/test/application/rake/migrations_test.rb b/railties/test/application/rake/migrations_test.rb
index b3e95769fa..d608fa1976 100644
--- a/railties/test/application/rake/migrations_test.rb
+++ b/railties/test/application/rake/migrations_test.rb
@@ -42,17 +42,17 @@ module ApplicationTests
`bin/rails generate model user username:string password:string;
bin/rails generate migration add_email_to_users email:string`
- output = `bin/rails db:migrate`
- assert_match(/create_table\(:users\)/, output)
- assert_match(/CreateUsers: migrated/, output)
- assert_match(/add_column\(:users, :email, :string\)/, output)
- assert_match(/AddEmailToUsers: migrated/, output)
-
- output = `bin/rails db:rollback STEP=2`
- assert_match(/drop_table\(:users\)/, output)
- assert_match(/CreateUsers: reverted/, output)
- assert_match(/remove_column\(:users, :email, :string\)/, output)
- assert_match(/AddEmailToUsers: reverted/, output)
+ output = `bin/rails db:migrate`
+ assert_match(/create_table\(:users\)/, output)
+ assert_match(/CreateUsers: migrated/, output)
+ assert_match(/add_column\(:users, :email, :string\)/, output)
+ assert_match(/AddEmailToUsers: migrated/, output)
+
+ output = `bin/rails db:rollback STEP=2`
+ assert_match(/drop_table\(:users\)/, output)
+ assert_match(/CreateUsers: reverted/, output)
+ assert_match(/remove_column\(:users, :email, :string\)/, output)
+ assert_match(/AddEmailToUsers: reverted/, output)
end
end
@@ -107,22 +107,22 @@ module ApplicationTests
bin/rails generate migration add_email_to_users email:string;
bin/rails db:migrate`
- output = `bin/rails db:migrate:status`
+ output = `bin/rails db:migrate:status`
- assert_match(/up\s+\d{14}\s+Create users/, output)
- assert_match(/up\s+\d{14}\s+Add email to users/, output)
+ assert_match(/up\s+\d{14}\s+Create users/, output)
+ assert_match(/up\s+\d{14}\s+Add email to users/, output)
- `bin/rails db:rollback STEP=2`
- output = `bin/rails db:migrate:status`
+ `bin/rails db:rollback STEP=2`
+ output = `bin/rails db:migrate:status`
- assert_match(/down\s+\d{14}\s+Create users/, output)
- assert_match(/down\s+\d{14}\s+Add email to users/, output)
+ assert_match(/down\s+\d{14}\s+Create users/, output)
+ assert_match(/down\s+\d{14}\s+Add email to users/, output)
- `bin/rails db:migrate:redo`
- output = `bin/rails db:migrate:status`
+ `bin/rails db:migrate:redo`
+ output = `bin/rails db:migrate:status`
- assert_match(/up\s+\d{14}\s+Create users/, output)
- assert_match(/up\s+\d{14}\s+Add email to users/, output)
+ assert_match(/up\s+\d{14}\s+Create users/, output)
+ assert_match(/up\s+\d{14}\s+Add email to users/, output)
end
end
@@ -134,22 +134,22 @@ module ApplicationTests
bin/rails generate migration add_email_to_users email:string;
bin/rails db:migrate`
- output = `bin/rails db:migrate:status`
+ output = `bin/rails db:migrate:status`
- assert_match(/up\s+\d{3,}\s+Create users/, output)
- assert_match(/up\s+\d{3,}\s+Add email to users/, output)
+ assert_match(/up\s+\d{3,}\s+Create users/, output)
+ assert_match(/up\s+\d{3,}\s+Add email to users/, output)
- `bin/rails db:rollback STEP=2`
- output = `bin/rails db:migrate:status`
+ `bin/rails db:rollback STEP=2`
+ output = `bin/rails db:migrate:status`
- assert_match(/down\s+\d{3,}\s+Create users/, output)
- assert_match(/down\s+\d{3,}\s+Add email to users/, output)
+ assert_match(/down\s+\d{3,}\s+Create users/, output)
+ assert_match(/down\s+\d{3,}\s+Add email to users/, output)
- `bin/rails db:migrate:redo`
- output = `bin/rails db:migrate:status`
+ `bin/rails db:migrate:redo`
+ output = `bin/rails db:migrate:status`
- assert_match(/up\s+\d{3,}\s+Create users/, output)
- assert_match(/up\s+\d{3,}\s+Add email to users/, output)
+ assert_match(/up\s+\d{3,}\s+Create users/, output)
+ assert_match(/up\s+\d{3,}\s+Add email to users/, output)
end
end
@@ -168,10 +168,10 @@ module ApplicationTests
`bin/rails db:migrate`
- output = `bin/rails db:migrate:status`
+ output = `bin/rails db:migrate:status`
- assert_match(/up\s+001\s+One migration/, output)
- assert_match(/up\s+002\s+Two migration/, output)
+ assert_match(/up\s+001\s+One migration/, output)
+ assert_match(/up\s+002\s+Two migration/, output)
end
end
diff --git a/railties/test/application/rake/notes_test.rb b/railties/test/application/rake/notes_test.rb
index c0ff3af193..b3f379d707 100644
--- a/railties/test/application/rake/notes_test.rb
+++ b/railties/test/application/rake/notes_test.rb
@@ -140,29 +140,29 @@ module ApplicationTests
private
- def run_rake_notes(command = "bin/rails notes")
- boot_rails
- load_tasks
+ def run_rake_notes(command = "bin/rails notes")
+ boot_rails
+ load_tasks
- Dir.chdir(app_path) do
- output = `#{command}`
- lines = output.scan(/\[([0-9\s]+)\]\s/).flatten
+ Dir.chdir(app_path) do
+ output = `#{command}`
+ lines = output.scan(/\[([0-9\s]+)\]\s/).flatten
- yield output, lines
+ yield output, lines
+ end
end
- end
- def load_tasks
- require "rake"
- require "rdoc/task"
- require "rake/testtask"
+ def load_tasks
+ require "rake"
+ require "rdoc/task"
+ require "rake/testtask"
- Rails.application.load_tasks
- end
+ Rails.application.load_tasks
+ end
- def boot_rails
- require "#{app_path}/config/environment"
- end
+ def boot_rails
+ require "#{app_path}/config/environment"
+ end
end
end
end
diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb
index 3f75dc8d58..b3343d9b7f 100644
--- a/railties/test/commands/console_test.rb
+++ b/railties/test/commands/console_test.rb
@@ -117,38 +117,38 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
private
- def start(argv = [])
- rails_console = Rails::Console.new(app, parse_arguments(argv))
- @output = capture(:stdout) { rails_console.start }
- end
+ def start(argv = [])
+ rails_console = Rails::Console.new(app, parse_arguments(argv))
+ @output = capture(:stdout) { rails_console.start }
+ end
- def app
- @app ||= build_app(FakeConsole)
- end
+ def app
+ @app ||= build_app(FakeConsole)
+ end
- def build_app(console)
- mocked_console = Class.new do
- attr_reader :sandbox, :console
+ def build_app(console)
+ mocked_console = Class.new do
+ attr_reader :sandbox, :console
- def initialize(console)
- @console = console
- end
+ def initialize(console)
+ @console = console
+ end
- def config
- self
- end
+ def config
+ self
+ end
- def sandbox=(arg)
- @sandbox = arg
- end
+ def sandbox=(arg)
+ @sandbox = arg
+ end
- def load_console
+ def load_console
+ end
end
+ mocked_console.new(console)
end
- mocked_console.new(console)
- end
- def parse_arguments(args)
- Rails::Console.parse_arguments(args)
- end
+ def parse_arguments(args)
+ Rails::Console.parse_arguments(args)
+ end
end
diff --git a/railties/test/commands/dbconsole_test.rb b/railties/test/commands/dbconsole_test.rb
index 128b930528..5304790c92 100644
--- a/railties/test/commands/dbconsole_test.rb
+++ b/railties/test/commands/dbconsole_test.rb
@@ -226,39 +226,39 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
private
- def app_db_config(results)
- Rails.application.config.stub(:database_configuration, results || {}) do
- yield
+ def app_db_config(results)
+ Rails.application.config.stub(:database_configuration, results || {}) do
+ yield
+ end
end
- end
- def dbconsole
- @dbconsole ||= Class.new(Rails::DBConsole) do
- attr_reader :find_cmd_and_exec_args
+ def dbconsole
+ @dbconsole ||= Class.new(Rails::DBConsole) do
+ attr_reader :find_cmd_and_exec_args
- def find_cmd_and_exec(*args)
- @find_cmd_and_exec_args = args
- end
- end.new(nil)
- end
+ def find_cmd_and_exec(*args)
+ @find_cmd_and_exec_args = args
+ end
+ end.new(nil)
+ end
- def start(config = {}, argv = [])
- dbconsole.stub(:config, config.stringify_keys) do
- dbconsole.stub(:arguments, argv) do
- capture_abort { dbconsole.start }
+ def start(config = {}, argv = [])
+ dbconsole.stub(:config, config.stringify_keys) do
+ dbconsole.stub(:arguments, argv) do
+ capture_abort { dbconsole.start }
+ end
end
end
- end
- def capture_abort
- @aborted = false
- @output = capture(:stderr) do
- begin
- yield
- rescue SystemExit
- @aborted = true
+ def capture_abort
+ @aborted = false
+ @output = capture(:stderr) do
+ begin
+ yield
+ rescue SystemExit
+ @aborted = true
+ end
end
end
- end
end
diff --git a/railties/test/configuration/middleware_stack_proxy_test.rb b/railties/test/configuration/middleware_stack_proxy_test.rb
index 586982c8dc..559ce72693 100644
--- a/railties/test/configuration/middleware_stack_proxy_test.rb
+++ b/railties/test/configuration/middleware_stack_proxy_test.rb
@@ -50,12 +50,12 @@ module Rails
private
- def assert_playback(msg_name, args)
- mock = Minitest::Mock.new
- mock.expect :send, nil, [msg_name, args]
- @stack.merge_into(mock)
- mock.verify
- end
+ def assert_playback(msg_name, args)
+ mock = Minitest::Mock.new
+ mock.expect :send, nil, [msg_name, args]
+ @stack.merge_into(mock)
+ mock.verify
+ end
end
end
end
diff --git a/railties/test/env_helpers.rb b/railties/test/env_helpers.rb
index 68366b336f..1f64d5fda3 100644
--- a/railties/test/env_helpers.rb
+++ b/railties/test/env_helpers.rb
@@ -3,28 +3,28 @@ require "rails"
module EnvHelpers
private
- def with_rails_env(env)
- Rails.instance_variable_set :@_env, nil
- switch_env "RAILS_ENV", env do
- switch_env "RACK_ENV", nil do
- yield
+ def with_rails_env(env)
+ Rails.instance_variable_set :@_env, nil
+ switch_env "RAILS_ENV", env do
+ switch_env "RACK_ENV", nil do
+ yield
+ end
end
end
- end
- def with_rack_env(env)
- Rails.instance_variable_set :@_env, nil
- switch_env "RACK_ENV", env do
- switch_env "RAILS_ENV", nil do
- yield
+ def with_rack_env(env)
+ Rails.instance_variable_set :@_env, nil
+ switch_env "RACK_ENV", env do
+ switch_env "RAILS_ENV", nil do
+ yield
+ end
end
end
- end
- def switch_env(key, value)
- old, ENV[key] = ENV[key], value
- yield
- ensure
- ENV[key] = old
- end
+ def switch_env(key, value)
+ old, ENV[key] = ENV[key], value
+ yield
+ ensure
+ ENV[key] = old
+ end
end
diff --git a/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb b/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb
index d4262f8971..636bc1a8ab 100644
--- a/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb
+++ b/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb
@@ -1 +1 @@
-# intentionally empty \ No newline at end of file
+# intentionally empty
diff --git a/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb b/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
index d4262f8971..636bc1a8ab 100644
--- a/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
+++ b/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb
@@ -1 +1 @@
-# intentionally empty \ No newline at end of file
+# intentionally empty
diff --git a/railties/test/fixtures/lib/generators/model_generator.rb b/railties/test/fixtures/lib/generators/model_generator.rb
index 9098a8a354..0905fa9631 100644
--- a/railties/test/fixtures/lib/generators/model_generator.rb
+++ b/railties/test/fixtures/lib/generators/model_generator.rb
@@ -1 +1 @@
-raise "I should never be loaded" \ No newline at end of file
+raise "I should never be loaded"
diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb
index 614ff28da1..bbb814ef4e 100644
--- a/railties/test/generators/api_app_generator_test.rb
+++ b/railties/test/generators/api_app_generator_test.rb
@@ -73,50 +73,50 @@ class ApiAppGeneratorTest < Rails::Generators::TestCase
private
- def default_files
- files = %W(
- .gitignore
- Gemfile
- Rakefile
- config.ru
- app/controllers
- app/mailers
- app/models
- app/views/layouts/mailer.html.erb
- app/views/layouts/mailer.text.erb
- config/environments
- config/initializers
- config/locales
- db
- lib
- lib/tasks
- log
- test/fixtures
- test/controllers
- test/integration
- test/models
- tmp
- vendor
- )
- files.concat %w(bin/bundle bin/rails bin/rake)
- files
- end
+ def default_files
+ files = %W(
+ .gitignore
+ Gemfile
+ Rakefile
+ config.ru
+ app/controllers
+ app/mailers
+ app/models
+ app/views/layouts/mailer.html.erb
+ app/views/layouts/mailer.text.erb
+ config/environments
+ config/initializers
+ config/locales
+ db
+ lib
+ lib/tasks
+ log
+ test/fixtures
+ test/controllers
+ test/integration
+ test/models
+ tmp
+ vendor
+ )
+ files.concat %w(bin/bundle bin/rails bin/rake)
+ files
+ end
- def skipped_files
- %w(app/assets
- app/helpers
- app/views/layouts/application.html.erb
- config/initializers/assets.rb
- config/initializers/cookies_serializer.rb
- lib/assets
- vendor/assets
- test/helpers
- tmp/cache/assets
- public/404.html
- public/422.html
- public/500.html
- public/apple-touch-icon-precomposed.png
- public/apple-touch-icon.png
- public/favicon.ico)
- end
+ def skipped_files
+ %w(app/assets
+ app/helpers
+ app/views/layouts/application.html.erb
+ config/initializers/assets.rb
+ config/initializers/cookies_serializer.rb
+ lib/assets
+ vendor/assets
+ test/helpers
+ tmp/cache/assets
+ public/404.html
+ public/422.html
+ public/500.html
+ public/apple-touch-icon-precomposed.png
+ public/apple-touch-icon.png
+ public/favicon.ico)
+ end
end
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 54c5115fd9..969c2df718 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -745,7 +745,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
sequence = ["install", "exec spring binstub --all", "echo ran after_bundle"]
- @sequence_step ||= 0
+ @sequence_step ||= 0
ensure_bundler_first = -> command do
assert_equal sequence[@sequence_step], command, "commands should be called in sequence #{sequence}"
@sequence_step += 1
diff --git a/railties/test/generators/model_generator_test.rb b/railties/test/generators/model_generator_test.rb
index d10671a7b4..6451aa75c9 100644
--- a/railties/test/generators/model_generator_test.rb
+++ b/railties/test/generators/model_generator_test.rb
@@ -6,13 +6,13 @@ class ModelGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(Account name:string age:integer)
- def test_application_record_skeleton_is_created
- run_generator
- assert_file "app/models/application_record.rb" do |record|
- assert_match(/class ApplicationRecord < ActiveRecord::Base/, record)
- assert_match(/self.abstract_class = true/, record)
- end
- end
+ def test_application_record_skeleton_is_created
+ run_generator
+ assert_file "app/models/application_record.rb" do |record|
+ assert_match(/class ApplicationRecord < ActiveRecord::Base/, record)
+ assert_match(/self.abstract_class = true/, record)
+ end
+ end
def test_help_shows_invoked_generators_options
content = run_generator ["--help"]
diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb
index 90439fe778..37036db16d 100644
--- a/railties/test/railties/mounted_engine_test.rb
+++ b/railties/test/railties/mounted_engine_test.rb
@@ -2,9 +2,9 @@ require "isolation/abstract_unit"
module ApplicationTests
class ApplicationRoutingTest < ActiveSupport::TestCase
- require "rack/test"
- include Rack::Test::Methods
- include ActiveSupport::Testing::Isolation
+ require "rack/test"
+ include Rack::Test::Methods
+ include ActiveSupport::Testing::Isolation
def setup
build_app
diff --git a/railties/test/test_unit/reporter_test.rb b/railties/test/test_unit/reporter_test.rb
index 875bc954eb..e22c939981 100644
--- a/railties/test/test_unit/reporter_test.rb
+++ b/railties/test/test_unit/reporter_test.rb
@@ -156,38 +156,38 @@ class TestUnitReporterTest < ActiveSupport::TestCase
end
private
- def assert_rerun_snippet_count(snippet_count)
- assert_equal snippet_count, @output.string.scan(%r{^bin/rails test }).size
- end
+ def assert_rerun_snippet_count(snippet_count)
+ assert_equal snippet_count, @output.string.scan(%r{^bin/rails test }).size
+ end
- def failed_test
- ft = ExampleTest.new(:woot)
- ft.failures << begin
- raise Minitest::Assertion, "boo"
- rescue Minitest::Assertion => e
- e
- end
- ft
- end
+ def failed_test
+ ft = ExampleTest.new(:woot)
+ ft.failures << begin
+ raise Minitest::Assertion, "boo"
+ rescue Minitest::Assertion => e
+ e
+ end
+ ft
+ end
- def errored_test
- et = ExampleTest.new(:woot)
- et.failures << Minitest::UnexpectedError.new(ArgumentError.new("wups"))
- et
- end
+ def errored_test
+ et = ExampleTest.new(:woot)
+ et.failures << Minitest::UnexpectedError.new(ArgumentError.new("wups"))
+ et
+ end
- def passing_test
- ExampleTest.new(:woot)
- end
+ def passing_test
+ ExampleTest.new(:woot)
+ end
- def skipped_test
- st = ExampleTest.new(:woot)
- st.failures << begin
- raise Minitest::Skip, "skipchurches, misstemples"
- rescue Minitest::Assertion => e
- e
- end
- st.time = 10
- st
- end
+ def skipped_test
+ st = ExampleTest.new(:woot)
+ st.failures << begin
+ raise Minitest::Skip, "skipchurches, misstemples"
+ rescue Minitest::Assertion => e
+ e
+ end
+ st.time = 10
+ st
+ end
end