From 762e3f05f3d372cb32570db0deeef27232c4dd00 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sun, 7 Aug 2016 17:50:59 +0900 Subject: [PATCH] Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty lines --- .rubocop.yml | 4 ++++ actioncable/lib/action_cable/channel/base.rb | 1 - actioncable/test/subscription_adapter/common.rb | 2 -- actionmailer/test/base_test.rb | 1 - actionpack/lib/action_dispatch/journey/parser.rb | 1 - actionpack/lib/action_dispatch/routing/polymorphic_routes.rb | 2 -- actionpack/test/abstract_unit.rb | 1 - actionpack/test/controller/caching_test.rb | 1 - actionpack/test/controller/helper_test.rb | 1 - actionpack/test/controller/mime/respond_to_test.rb | 2 -- actionpack/test/controller/render_json_test.rb | 1 - actionpack/test/controller/request_forgery_protection_test.rb | 1 - actionpack/test/controller/send_file_test.rb | 1 - actionpack/test/dispatch/request_id_test.rb | 1 - actionpack/test/dispatch/request_test.rb | 1 - actionpack/test/dispatch/routing/inspector_test.rb | 1 - actionpack/test/dispatch/static_test.rb | 1 - actionview/lib/action_view/dependency_tracker.rb | 1 - actionview/test/active_record_unit.rb | 1 - actionview/test/template/date_helper_test.rb | 2 -- actionview/test/template/form_helper_test.rb | 1 - actionview/test/template/form_options_helper_test.rb | 1 - actionview/test/template/form_tag_helper_test.rb | 1 - activejob/test/cases/queuing_test.rb | 2 -- activejob/test/jobs/callback_job.rb | 1 - activejob/test/support/integration/adapters/sneakers.rb | 1 - activemodel/test/cases/validations/callbacks_test.rb | 1 - activemodel/test/cases/validations/length_validation_test.rb | 1 - .../associations/preloader/through_association.rb | 1 - .../lib/active_record/connection_adapters/schema_cache.rb | 1 - activerecord/lib/active_record/locking/optimistic.rb | 1 - activerecord/lib/active_record/railtie.rb | 1 - activerecord/lib/active_record/reflection.rb | 1 - activerecord/lib/active_record/relation/predicate_builder.rb | 1 - activerecord/test/cases/adapters/postgresql/datatype_test.rb | 1 - activerecord/test/cases/associations/callbacks_test.rb | 1 - .../test/cases/associations/eager_load_nested_include_test.rb | 2 -- .../test/cases/associations/eager_singularization_test.rb | 1 - .../test/cases/associations/inverse_associations_test.rb | 1 - activerecord/test/cases/associations/join_model_test.rb | 1 - activerecord/test/cases/associations_test.rb | 1 - activerecord/test/cases/dirty_test.rb | 2 -- activerecord/test/cases/fixtures_test.rb | 1 - activerecord/test/cases/locking_test.rb | 1 - activerecord/test/cases/migration/index_test.rb | 1 - activerecord/test/cases/migration_test.rb | 1 - activerecord/test/cases/readonly_test.rb | 1 - activerecord/test/cases/relation/mutation_test.rb | 1 - activerecord/test/cases/relations_test.rb | 1 - activerecord/test/cases/statement_cache_test.rb | 1 - activerecord/test/cases/transaction_callbacks_test.rb | 1 - activerecord/test/cases/validations/length_validation_test.rb | 1 - activerecord/test/models/person.rb | 1 - activesupport/lib/active_support/concurrency/share_lock.rb | 1 - .../lib/active_support/hash_with_indifferent_access.rb | 1 - activesupport/lib/active_support/test_case.rb | 1 - activesupport/test/callbacks_test.rb | 4 ---- activesupport/test/core_ext/hash_ext_test.rb | 1 - activesupport/test/core_ext/load_error_test.rb | 1 - activesupport/test/core_ext/module_test.rb | 1 - activesupport/test/core_ext/numeric_ext_test.rb | 2 -- activesupport/test/dependencies_test.rb | 1 - activesupport/test/deprecation_test.rb | 1 - activesupport/test/file_update_checker_shared_tests.rb | 2 -- activesupport/test/inflector_test.rb | 1 - activesupport/test/json/encoding_test.rb | 1 - activesupport/test/multibyte_unicode_database_test.rb | 1 - activesupport/test/rescuable_test.rb | 1 - activesupport/test/xml_mini/jdom_engine_test.rb | 2 -- activesupport/test/xml_mini/libxml_engine_test.rb | 1 - railties/lib/rails/generators/actions.rb | 1 - railties/test/application/configuration_test.rb | 1 - railties/test/commands/console_test.rb | 1 - railties/test/generators/plugin_generator_test.rb | 1 - railties/test/railties/engine_test.rb | 2 -- railties/test/railties/mounted_engine_test.rb | 2 -- 76 files changed, 4 insertions(+), 90 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6ab1146b40..d56e757e71 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,6 +20,10 @@ Style/BracesAroundHashParameters: Style/CaseIndentation: Enabled: true +# No extra empty lines. +Style/EmptyLines: + Enabled: true + # In a regular class definition, no empty lines around the body. Style/EmptyLinesAroundClassBody: Enabled: true diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index 1dda0e407f..8ab061171e 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -177,7 +177,6 @@ module ActionCable end end - protected # Called once a consumer has become a subscriber of the channel. Usually the place to setup any streams # you want this channel to be sending to the subscriber. diff --git a/actioncable/test/subscription_adapter/common.rb b/actioncable/test/subscription_adapter/common.rb index bf4dd701fc..1538157995 100644 --- a/actioncable/test/subscription_adapter/common.rb +++ b/actioncable/test/subscription_adapter/common.rb @@ -23,7 +23,6 @@ module CommonSubscriptionAdapterTest [@rx_adapter, @tx_adapter].uniq.each(&:shutdown) end - def subscribe_as_queue(channel, adapter = @rx_adapter) queue = Queue.new @@ -41,7 +40,6 @@ module CommonSubscriptionAdapterTest adapter.unsubscribe(channel, callback) if subscribed.set? end - def test_subscribe_and_unsubscribe subscribe_as_queue("channel") do |queue| end diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index 5b0566a131..9594cccc4d 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -380,7 +380,6 @@ class BaseTest < ActiveSupport::TestCase end end - test "implicit multipart with several view paths uses the first one with template" do old = BaseMailer.view_paths begin diff --git a/actionpack/lib/action_dispatch/journey/parser.rb b/actionpack/lib/action_dispatch/journey/parser.rb index 38984edd3b..91fef7e96f 100644 --- a/actionpack/lib/action_dispatch/journey/parser.rb +++ b/actionpack/lib/action_dispatch/journey/parser.rb @@ -6,7 +6,6 @@ require "racc/parser.rb" - require "action_dispatch/journey/parser_extras" module ActionDispatch module Journey diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb index 3e2b21ac72..eb96466aa5 100644 --- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb @@ -134,7 +134,6 @@ module ActionDispatch opts end - %w(edit new).each do |action| module_eval <<-EOT, __FILE__, __LINE__ + 1 def #{action}_polymorphic_url(record_or_hash, options = {}) @@ -211,7 +210,6 @@ module ActionDispatch method, args = builder.handle_model record_or_hash_or_array end - if options.empty? recipient.send(method, *args) else diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 367eb90831..1c7f6b4e41 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -247,7 +247,6 @@ module ActionController end end - class ::ApplicationController < ActionController::Base end diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 97d77706d1..08aa383886 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -277,7 +277,6 @@ CACHED @store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached")}") end - def test_fragment_caching_with_variant get :formatted_fragment_cached_with_variant, format: "html", params: { v: :phone } assert_response :success diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index d18e19f961..981b67f685 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -247,7 +247,6 @@ class HelperTest < ActiveSupport::TestCase end end - class IsolatedHelpersTest < ActionController::TestCase class A < ActionController::Base def index diff --git a/actionpack/test/controller/mime/respond_to_test.rb b/actionpack/test/controller/mime/respond_to_test.rb index 26545686df..2b6d319999 100644 --- a/actionpack/test/controller/mime/respond_to_test.rb +++ b/actionpack/test/controller/mime/respond_to_test.rb @@ -51,7 +51,6 @@ class RespondToController < ActionController::Base end end - def forced_xml request.format = :xml @@ -109,7 +108,6 @@ class RespondToController < ActionController::Base end end - def custom_constant_handling respond_to do |type| type.html { render body: "HTML" } diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb index 69fbf59905..31b11588fd 100644 --- a/actionpack/test/controller/render_json_test.rb +++ b/actionpack/test/controller/render_json_test.rb @@ -86,7 +86,6 @@ class RenderJsonTest < ActionController::TestCase assert_equal "[]", @response.body end - def test_render_json get :render_json_hello_world assert_equal '{"hello":"world"}', @response.body diff --git a/actionpack/test/controller/request_forgery_protection_test.rb b/actionpack/test/controller/request_forgery_protection_test.rb index 2e6b7be88b..03f112c34d 100644 --- a/actionpack/test/controller/request_forgery_protection_test.rb +++ b/actionpack/test/controller/request_forgery_protection_test.rb @@ -99,7 +99,6 @@ class PrependProtectForgeryBaseController < ActionController::Base @called_callbacks << name end - def custom_action add_called_callback("custom_action") end diff --git a/actionpack/test/controller/send_file_test.rb b/actionpack/test/controller/send_file_test.rb index e78478b16c..3fb0ee8059 100644 --- a/actionpack/test/controller/send_file_test.rb +++ b/actionpack/test/controller/send_file_test.rb @@ -159,7 +159,6 @@ class SendFileTest < ActionController::TestCase assert_equal "image/png", response.content_type end - def test_send_file_headers_with_bad_symbol error = assert_raise(ArgumentError) { get __method__ } assert_equal "Unknown MIME type this_type_is_not_registered", error.message diff --git a/actionpack/test/dispatch/request_id_test.rb b/actionpack/test/dispatch/request_id_test.rb index 793ce67db4..4fcd45acf5 100644 --- a/actionpack/test/dispatch/request_id_test.rb +++ b/actionpack/test/dispatch/request_id_test.rb @@ -50,7 +50,6 @@ class RequestIdResponseTest < ActionDispatch::IntegrationTest end end - private def with_test_route_set diff --git a/actionpack/test/dispatch/request_test.rb b/actionpack/test/dispatch/request_test.rb index 0cac971daa..0dc8a2508e 100644 --- a/actionpack/test/dispatch/request_test.rb +++ b/actionpack/test/dispatch/request_test.rb @@ -1069,7 +1069,6 @@ class RequestParameters < BaseRequestTest end end - class RequestParameterFilter < BaseRequestTest test "process parameter filter" do test_hashes = [ diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb index 115770b7cd..97137a4762 100644 --- a/actionpack/test/dispatch/routing/inspector_test.rb +++ b/actionpack/test/dispatch/routing/inspector_test.rb @@ -338,7 +338,6 @@ module ActionDispatch " DELETE /admin/posts/:id(.:format) admin/posts#destroy"], output end - def test_regression_route_with_controller_regexp output = draw do ActiveSupport::Deprecation.silence do diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index 404cc00cd1..e8f0ce21e9 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -82,7 +82,6 @@ module StaticTests assert_html "means hello in Japanese\n", get("/foo/#{Rack::Utils.escape("こんにちは.html")}") end - def test_serves_static_file_with_exclamation_mark_in_filename with_static_file "/foo/foo!bar.html" do |file| assert_html file, get("/foo/foo%21bar.html") diff --git a/actionview/lib/action_view/dependency_tracker.rb b/actionview/lib/action_view/dependency_tracker.rb index 67d98e9721..451eeec9d6 100644 --- a/actionview/lib/action_view/dependency_tracker.rb +++ b/actionview/lib/action_view/dependency_tracker.rb @@ -105,7 +105,6 @@ module ActionView attr_reader :name, :template private :name, :template - private def source template.source diff --git a/actionview/test/active_record_unit.rb b/actionview/test/active_record_unit.rb index c757c3392e..62ca2779fa 100644 --- a/actionview/test/active_record_unit.rb +++ b/actionview/test/active_record_unit.rb @@ -24,7 +24,6 @@ unless defined?(ActiveRecord) && defined?(FixtureSet) end $stderr.flush - # Define the rest of the connector class ActiveRecordTestConnector class << self diff --git a/actionview/test/template/date_helper_test.rb b/actionview/test/template/date_helper_test.rb index a40bc1c131..d83be49f40 100644 --- a/actionview/test/template/date_helper_test.rb +++ b/actionview/test/template/date_helper_test.rb @@ -1318,7 +1318,6 @@ class DateHelperTest < ActionView::TestCase expected << %(\n\n\n) expected << "\n" - expected << %(\n" @@ -1953,7 +1952,6 @@ class DateHelperTest < ActionView::TestCase concat f.date_select(:written_on) end - expected = %{\n} expected << %{\n} expected << %{\n} diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb index ed58818602..590e79d114 100644 --- a/actionview/test/template/form_helper_test.rb +++ b/actionview/test/template/form_helper_test.rb @@ -2257,7 +2257,6 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end - def test_nested_fields_for_with_nested_collections form_for(@post, as: "post[]") do |f| concat f.text_field(:title) diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 84c322e522..18dfec1b37 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -57,7 +57,6 @@ class FormOptionsHelperTest < ActionView::TestCase ) end - def test_collection_options_with_preselected_value assert_dom_equal( "\n\n", diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb index 52f32e9f0e..a639b56b0b 100644 --- a/actionview/test/template/form_tag_helper_test.rb +++ b/actionview/test/template/form_tag_helper_test.rb @@ -517,7 +517,6 @@ class FormTagHelperTest < ActionView::TestCase ) end - def test_button_tag assert_dom_equal( %(), diff --git a/activejob/test/cases/queuing_test.rb b/activejob/test/cases/queuing_test.rb index 9690e0cc79..a3ecb15c31 100644 --- a/activejob/test/cases/queuing_test.rb +++ b/activejob/test/cases/queuing_test.rb @@ -2,7 +2,6 @@ require "helper" require "jobs/hello_job" require "active_support/core_ext/numeric/time" - class QueuingTest < ActiveSupport::TestCase setup do JobBuffer.clear @@ -32,7 +31,6 @@ class QueuingTest < ActiveSupport::TestCase assert_equal [ "Jamie" ], job.arguments end - test "job returned by perform_at has the timestamp available" do begin job = HelloJob.set(wait_until: Time.utc(2014, 1, 1)).perform_later diff --git a/activejob/test/jobs/callback_job.rb b/activejob/test/jobs/callback_job.rb index 7f9fc1c74a..ca2a8e031a 100644 --- a/activejob/test/jobs/callback_job.rb +++ b/activejob/test/jobs/callback_job.rb @@ -17,7 +17,6 @@ class CallbackJob < ActiveJob::Base job.history << "CallbackJob ran around_enqueue_stop" end - def perform(person = "david") # NOTHING! end diff --git a/activejob/test/support/integration/adapters/sneakers.rb b/activejob/test/support/integration/adapters/sneakers.rb index b3639572fb..08743c1f05 100644 --- a/activejob/test/support/integration/adapters/sneakers.rb +++ b/activejob/test/support/integration/adapters/sneakers.rb @@ -12,7 +12,6 @@ module Sneakers end end - module SneakersJobsManager def setup ActiveJob::Base.queue_adapter = :sneakers diff --git a/activemodel/test/cases/validations/callbacks_test.rb b/activemodel/test/cases/validations/callbacks_test.rb index 99913be752..3a25ffa46f 100644 --- a/activemodel/test/cases/validations/callbacks_test.rb +++ b/activemodel/test/cases/validations/callbacks_test.rb @@ -71,7 +71,6 @@ class DogValidatorWithIfCondition < Dog def set_after_validation_marker2; self.history << "after_validation_marker2" ; end end - class CallbacksWithMethodNamesShouldBeCalled < ActiveModel::TestCase def test_if_condition_is_respected_for_before_validation d = DogValidatorWithIfCondition.new diff --git a/activemodel/test/cases/validations/length_validation_test.rb b/activemodel/test/cases/validations/length_validation_test.rb index dbbfb8351b..63326aca69 100644 --- a/activemodel/test/cases/validations/length_validation_test.rb +++ b/activemodel/test/cases/validations/length_validation_test.rb @@ -336,7 +336,6 @@ class LengthValidationTest < ActiveModel::TestCase assert_equal ["Your essay must be at least 5 words."], t.errors[:content] end - def test_validates_length_of_with_symbol assert_deprecated do Topic.validates_length_of( diff --git a/activerecord/lib/active_record/associations/preloader/through_association.rb b/activerecord/lib/active_record/associations/preloader/through_association.rb index f53c30f80e..be9dfe7686 100644 --- a/activerecord/lib/active_record/associations/preloader/through_association.rb +++ b/activerecord/lib/active_record/associations/preloader/through_association.rb @@ -79,7 +79,6 @@ module ActiveRecord end end - def through_scope scope = through_reflection.klass.unscoped diff --git a/activerecord/lib/active_record/connection_adapters/schema_cache.rb b/activerecord/lib/active_record/connection_adapters/schema_cache.rb index d1708a6af8..8219f132c3 100644 --- a/activerecord/lib/active_record/connection_adapters/schema_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/schema_cache.rb @@ -35,7 +35,6 @@ module ActiveRecord alias table_exists? data_source_exists? deprecate table_exists?: "use #data_source_exists? instead" - # Add internal cache for table with +table_name+. def add(table_name) if data_source_exists?(table_name) diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 21a6a2c55f..1b6cda3861 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -184,7 +184,6 @@ module ActiveRecord end end - # In de/serialize we change `nil` to 0, so that we can allow passing # `nil` values to `lock_version`, and not result in `ActiveRecord::StaleObjectError` # during update record. diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 35c19b27bb..989d23bc37 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -23,7 +23,6 @@ module ActiveRecord "ActiveRecord::RecordNotSaved" => :unprocessable_entity ) - config.active_record.use_schema_cache_dump = true config.active_record.maintain_test_schema = true diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 7caac60960..3553ff4da3 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -317,7 +317,6 @@ module ActiveRecord end end - # Holds all the meta-data about an aggregation as it was specified in the # Active Record class. class AggregateReflection < MacroReflection #:nodoc: diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index df663a84ed..ad3a0ba7c7 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -92,7 +92,6 @@ module ActiveRecord end end - def create_binds_for_hash(attributes) result = attributes.dup binds = [] diff --git a/activerecord/test/cases/adapters/postgresql/datatype_test.rb b/activerecord/test/cases/adapters/postgresql/datatype_test.rb index aa077b59a0..0ac8b7339b 100644 --- a/activerecord/test/cases/adapters/postgresql/datatype_test.rb +++ b/activerecord/test/cases/adapters/postgresql/datatype_test.rb @@ -1,7 +1,6 @@ require "cases/helper" require "support/ddl_helper" - class PostgresqlTime < ActiveRecord::Base end diff --git a/activerecord/test/cases/associations/callbacks_test.rb b/activerecord/test/cases/associations/callbacks_test.rb index 15ef2d55c3..74876c8cf0 100644 --- a/activerecord/test/cases/associations/callbacks_test.rb +++ b/activerecord/test/cases/associations/callbacks_test.rb @@ -137,7 +137,6 @@ class AssociationCallbacksTest < ActiveRecord::TestCase assert_equal "after_adding", ar.developers_log.last end - def test_has_and_belongs_to_many_remove_callback david = developers(:david) jamis = developers(:jamis) diff --git a/activerecord/test/cases/associations/eager_load_nested_include_test.rb b/activerecord/test/cases/associations/eager_load_nested_include_test.rb index 7a3d0c6068..aebece1b91 100644 --- a/activerecord/test/cases/associations/eager_load_nested_include_test.rb +++ b/activerecord/test/cases/associations/eager_load_nested_include_test.rb @@ -58,8 +58,6 @@ class NonPolyTwo < ActiveRecord::Base include Remembered end - - class EagerLoadPolyAssocsTest < ActiveRecord::TestCase NUM_SIMPLE_OBJS = 50 NUM_SHAPE_EXPRESSIONS = 100 diff --git a/activerecord/test/cases/associations/eager_singularization_test.rb b/activerecord/test/cases/associations/eager_singularization_test.rb index 373b17483c..5d1c1c4b9b 100644 --- a/activerecord/test/cases/associations/eager_singularization_test.rb +++ b/activerecord/test/cases/associations/eager_singularization_test.rb @@ -1,6 +1,5 @@ require "cases/helper" - if ActiveRecord::Base.connection.supports_migrations? class EagerSingularizationTest < ActiveRecord::TestCase class Virus < ActiveRecord::Base diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index ae0468ef1e..4534cbe664 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -226,7 +226,6 @@ class InverseHasOneTests < ActiveRecord::TestCase assert_equal m.name, f.man.name, "Name of man should be the same after changes to child-owned instance" end - def test_parent_instance_should_be_shared_with_eager_loaded_child_on_find m = Man.all.merge!(where: {name: "Gordon"}, includes: :face).first f = m.face diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 7d67c289ff..cf08cc9537 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -472,7 +472,6 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert new_tag.persisted? assert saved_post.reload.tags.reload.include?(new_tag) - new_post = Post.new(title: "Association replacement works!", body: "You best believe it.") saved_tag = tags(:general) diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 3ff9a625b2..45aefde3e1 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -56,7 +56,6 @@ class AssociationsTest < ActiveRecord::TestCase assert_equal "Deck", ship.parts[0].name end - def test_include_with_order_works assert_nothing_raised {Account.all.merge!(order: "id", includes: :firm).first} assert_nothing_raised {Account.all.merge!(order: :id, includes: :firm).first} diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 417383211d..32df15eef3 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -134,7 +134,6 @@ class DirtyTest < ActiveRecord::TestCase end end - def test_aliased_attribute_changes # the actual attribute here is name, title is an # alias setup via alias_attribute @@ -408,7 +407,6 @@ class DirtyTest < ActiveRecord::TestCase assert !pirate.changed? end - def test_reverted_changes_are_not_dirty_going_from_nil_to_value_and_back pirate = Pirate.create!(catchphrase: "Yar!") diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index 234e99919c..6f4b6ddbc0 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -479,7 +479,6 @@ class SetupSubclassTest < SetupTest end end - class OverlappingFixturesTest < ActiveRecord::TestCase fixtures :topics, :developers fixtures :developers, :accounts diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb index 84f252d5d1..5c55584ff7 100644 --- a/activerecord/test/cases/locking_test.rb +++ b/activerecord/test/cases/locking_test.rb @@ -374,7 +374,6 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase end end - # TODO: test against the generated SQL since testing locking behavior itself # is so cumbersome. Will deadlock Ruby threads if the underlying db.execute # blocks, so separate script called by Kernel#system is needed. diff --git a/activerecord/test/cases/migration/index_test.rb b/activerecord/test/cases/migration/index_test.rb index 0ac6df4a3d..85e09986ea 100644 --- a/activerecord/test/cases/migration/index_test.rb +++ b/activerecord/test/cases/migration/index_test.rb @@ -49,7 +49,6 @@ module ActiveRecord assert connection.index_name_exists?(table_name, "old_idx", false) end - def test_double_add_index connection.add_index(table_name, [:foo], name: "some_idx") assert_raises(ArgumentError) { diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index b8ffc8a154..50d39d942e 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -401,7 +401,6 @@ class MigrationTest < ActiveRecord::TestCase ENV["RACK_ENV"] = original_rack_env end - def test_migration_sets_internal_metadata_even_when_fully_migrated current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call migrations_path = MIGRATIONS_ROOT + "/valid" diff --git a/activerecord/test/cases/readonly_test.rb b/activerecord/test/cases/readonly_test.rb index 151bb31fbd..a93061b516 100644 --- a/activerecord/test/cases/readonly_test.rb +++ b/activerecord/test/cases/readonly_test.rb @@ -35,7 +35,6 @@ class ReadOnlyTest < ActiveRecord::TestCase assert_equal "Developer is marked as readonly", e.message end - def test_find_with_readonly_option Developer.all.each { |d| assert !d.readonly? } Developer.readonly(false).each { |d| assert !d.readonly? } diff --git a/activerecord/test/cases/relation/mutation_test.rb b/activerecord/test/cases/relation/mutation_test.rb index 14de5ae337..018a676a4a 100644 --- a/activerecord/test/cases/relation/mutation_test.rb +++ b/activerecord/test/cases/relation/mutation_test.rb @@ -132,7 +132,6 @@ module ActiveRecord assert_equal "title DESC", relation.order_values.first assert_equal "comments_count ASC", relation.order_values.last - relation.reverse_order! assert_equal "title ASC", relation.order_values.first diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 74a5b79dfd..8652ef1081 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -953,7 +953,6 @@ class RelationTest < ActiveRecord::TestCase } end - def test_find_all_using_where_with_relation_with_select_to_build_subquery david = authors(:david) assert_queries(1) { diff --git a/activerecord/test/cases/statement_cache_test.rb b/activerecord/test/cases/statement_cache_test.rb index df75dd3247..f45f63c68e 100644 --- a/activerecord/test/cases/statement_cache_test.rb +++ b/activerecord/test/cases/statement_cache_test.rb @@ -25,7 +25,6 @@ module ActiveRecord assert_equal "my other book", b[0].name end - def test_statement_cache_id b1 = Book.create(name: "my book") b2 = Book.create(name: "my other book") diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb index efb420b403..be23fb8a4a 100644 --- a/activerecord/test/cases/transaction_callbacks_test.rb +++ b/activerecord/test/cases/transaction_callbacks_test.rb @@ -449,7 +449,6 @@ class CallbacksOnMultipleActionsTest < ActiveRecord::TestCase end end - class TransactionEnrollmentCallbacksTest < ActiveRecord::TestCase class TopicWithoutTransactionalEnrollmentCallbacks < ActiveRecord::Base self.table_name = :topics diff --git a/activerecord/test/cases/validations/length_validation_test.rb b/activerecord/test/cases/validations/length_validation_test.rb index 08dd740b01..4fcb3e2eb6 100644 --- a/activerecord/test/cases/validations/length_validation_test.rb +++ b/activerecord/test/cases/validations/length_validation_test.rb @@ -12,7 +12,6 @@ class LengthValidationTest < ActiveRecord::TestCase end end - def test_validates_size_of_association assert_nothing_raised { @owner.validates_size_of :pets, minimum: 1 } o = @owner.new("name" => "nopets") diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index 84ffddb74e..18994d6f18 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -60,7 +60,6 @@ class PersonWithDependentNullifyJobs < ActiveRecord::Base has_many :jobs, source: :job, through: :references, dependent: :nullify end - class LoosePerson < ActiveRecord::Base self.table_name = "people" self.abstract_class = true diff --git a/activesupport/lib/active_support/concurrency/share_lock.rb b/activesupport/lib/active_support/concurrency/share_lock.rb index e61dadd0cc..8969ebb080 100644 --- a/activesupport/lib/active_support/concurrency/share_lock.rb +++ b/activesupport/lib/active_support/concurrency/share_lock.rb @@ -13,7 +13,6 @@ module ActiveSupport # we need exclusive locks to be reentrant, and we need to be able # to upgrade share locks to exclusive. - def raw_state # :nodoc: synchronize do threads = @sleeping.keys | @sharing.keys | @waiting.keys diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index fc0123c956..ad6c4f8e8c 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -161,7 +161,6 @@ module ActiveSupport alias_method :has_key?, :key? alias_method :member?, :key? - # Same as Hash#[] where the key passed as argument can be # either a string or a symbol: # diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 5ea3a7010b..a8e98b704a 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -66,7 +66,6 @@ module ActiveSupport alias :assert_not_respond_to :refute_respond_to alias :assert_not_same :refute_same - # Assertion that the block should not raise an exception. # # Passes if evaluated code in the yielded block raises no exception. diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 040e9c1cca..69b15b0086 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -181,8 +181,6 @@ module CallbacksTest end end - - class ConditionalPerson < Record # proc before_save Proc.new { |r| r.history << [:before_save, :proc] }, if: Proc.new { |r| true } @@ -489,8 +487,6 @@ module CallbacksTest end end - - class ResetCallbackTest < ActiveSupport::TestCase def test_save_conditional_person person = CleanPerson.new diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 8a9f33ae53..6a65f999fd 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -276,7 +276,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal @nested_symbols, @nested_mixed.with_indifferent_access.deep_symbolize_keys end - def test_symbolize_keys_bang_for_hash_with_indifferent_access assert_raise(NoMethodError) { @symbols.with_indifferent_access.dup.symbolize_keys! } assert_raise(NoMethodError) { @strings.with_indifferent_access.dup.symbolize_keys! } diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 4ed83c3415..b50a35b2cb 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,7 +1,6 @@ require "abstract_unit" require "active_support/core_ext/load_error" - class TestMissingSourceFile < ActiveSupport::TestCase def test_it_is_deprecated assert_deprecated do diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index bfe60e0f5f..104082b777 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -509,7 +509,6 @@ class MethodAliasingTest < ActiveSupport::TestCase assert_respond_to @instance, :quux_with_baz? assert_respond_to @instance, :quux_with_baz= - FooClassWithBarMethod.alias_method_chain :quux!, :baz assert_equal "quux!_with_baz", @instance.quux! assert_equal "quux!", @instance.quux_without_baz! diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index fc93a18ab1..b99217a1b3 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -176,7 +176,6 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal("£1234567890,50", 1234567890.50.to_s(:currency, unit: "£", separator: ",", delimiter: "")) end - def test_to_s__rounded assert_equal("-111.235", -111.2346.to_s(:rounded)) assert_equal("111.235", 111.2346.to_s(:rounded)) @@ -222,7 +221,6 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal "12.345.678,05", 12345678.05.to_s(:delimited, delimiter: ".", separator: ",") end - def test_to_s__rounded_with_custom_delimiter_and_separator assert_equal "31,83", 31.825.to_s(:rounded, precision: 2, separator: ",") assert_equal "1.231,83", 1231.825.to_s(:rounded, precision: 2, separator: ",", delimiter: ".") diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 1ee4d7f63c..1ed6337fca 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -1036,7 +1036,6 @@ class DependenciesTest < ActiveSupport::TestCase remove_constants(:A) end - def test_autoload_once_paths_should_behave_when_recursively_loading old_path = ActiveSupport::Dependencies.autoload_once_paths with_loading "dependencies", "autoloading_fixtures" do diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index 36c3a44c31..6669a70a00 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -35,7 +35,6 @@ class Deprecatee A = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Deprecatee::A", "Deprecatee::B::C") end - class DeprecationTest < ActiveSupport::TestCase include ActiveSupport::Testing::Stream diff --git a/activesupport/test/file_update_checker_shared_tests.rb b/activesupport/test/file_update_checker_shared_tests.rb index a749c1947c..cd6a58e840 100644 --- a/activesupport/test/file_update_checker_shared_tests.rb +++ b/activesupport/test/file_update_checker_shared_tests.rb @@ -80,7 +80,6 @@ module FileUpdateCheckerSharedTests assert_equal 1, i end - test "updated should become true when watched files are created" do i = 0 @@ -92,7 +91,6 @@ module FileUpdateCheckerSharedTests assert checker.updated? end - test "updated should become true when watched files are modified" do i = 0 diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index f0b7dda682..39e8c611e5 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -80,7 +80,6 @@ class InflectorTest < ActiveSupport::TestCase end end - def test_overwrite_previous_inflectors assert_equal("series", ActiveSupport::Inflector.singularize("series")) ActiveSupport::Inflector.inflections.singular "series", "serie" diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index 4a9ed22951..9c95bf35b8 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -306,7 +306,6 @@ class TestJSONEncoding < ActiveSupport::TestCase user_birthday = Struct::UserNameAndDate.new "David", Date.new(2010, 01, 01) custom = Struct::Custom.new "David", user_birthday - json_strings = "" json_string_and_date = "" json_custom = "" diff --git a/activesupport/test/multibyte_unicode_database_test.rb b/activesupport/test/multibyte_unicode_database_test.rb index 924db303b6..3724782930 100644 --- a/activesupport/test/multibyte_unicode_database_test.rb +++ b/activesupport/test/multibyte_unicode_database_test.rb @@ -1,6 +1,5 @@ require "abstract_unit" - class MultibyteUnicodeDatabaseTest < ActiveSupport::TestCase include ActiveSupport::Multibyte::Unicode diff --git a/activesupport/test/rescuable_test.rb b/activesupport/test/rescuable_test.rb index 283afca642..7e5c3d1a8f 100644 --- a/activesupport/test/rescuable_test.rb +++ b/activesupport/test/rescuable_test.rb @@ -97,7 +97,6 @@ class CoolStargate < Stargate end end - class RescuableTest < ActiveSupport::TestCase def setup @stargate = Stargate.new diff --git a/activesupport/test/xml_mini/jdom_engine_test.rb b/activesupport/test/xml_mini/jdom_engine_test.rb index 43edd49663..a776ad25c4 100644 --- a/activesupport/test/xml_mini/jdom_engine_test.rb +++ b/activesupport/test/xml_mini/jdom_engine_test.rb @@ -3,7 +3,6 @@ if RUBY_PLATFORM.include?("java") require "active_support/xml_mini" require "active_support/core_ext/hash/conversions" - class JDOMEngineTest < ActiveSupport::TestCase include ActiveSupport @@ -56,7 +55,6 @@ if RUBY_PLATFORM.include?("java") end end - def test_not_allowed_to_load_external_doctypes attack_xml = <<-EOT diff --git a/activesupport/test/xml_mini/libxml_engine_test.rb b/activesupport/test/xml_mini/libxml_engine_test.rb index d5fd17d06e..81b0d3c407 100644 --- a/activesupport/test/xml_mini/libxml_engine_test.rb +++ b/activesupport/test/xml_mini/libxml_engine_test.rb @@ -191,7 +191,6 @@ else eoxml end - private def assert_equal_rexml(xml) parsed_xml = XmlMini.parse(xml) diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 2959ae3169..ab9dc019e2 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -274,7 +274,6 @@ module Rails end end - # Runs the supplied command using either "rake ..." or "rails ..." # based on the executor parameter provided. def execute_command(executor, command, options={}) diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index ee482009d8..94d3bbd165 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -666,7 +666,6 @@ module ApplicationTests end RUBY - app_file "app/controllers/posts_controller.rb", <<-RUBY class PostsController < ApplicationController def index diff --git a/railties/test/commands/console_test.rb b/railties/test/commands/console_test.rb index b3343d9b7f..96ac7c0661 100644 --- a/railties/test/commands/console_test.rb +++ b/railties/test/commands/console_test.rb @@ -40,7 +40,6 @@ class Rails::ConsoleTest < ActiveSupport::TestCase def test_start_with_sandbox start ["--sandbox"] - assert app.console.started? assert app.sandbox assert_match(/Loading \w+ environment in sandbox \(Rails/, output) diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb index d20c2266a8..f5b1532e5f 100644 --- a/railties/test/generators/plugin_generator_test.rb +++ b/railties/test/generators/plugin_generator_test.rb @@ -618,7 +618,6 @@ class PluginGeneratorTest < Rails::Generators::TestCase end end - def test_api_generators_configuration_for_api_engines run_generator [destination_root, "--full", "--api"] diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index d6bd281c53..84867dcdec 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -1226,7 +1226,6 @@ YAML end RUBY - app_file "config/routes.rb", <<-RUBY Rails.application.routes.draw do mount Bukkits::Engine => "/" @@ -1276,7 +1275,6 @@ YAML end RUBY - @plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY class Bukkits::BukkitController < ActionController::Base def index diff --git a/railties/test/railties/mounted_engine_test.rb b/railties/test/railties/mounted_engine_test.rb index 37036db16d..9db42c0c38 100644 --- a/railties/test/railties/mounted_engine_test.rb +++ b/railties/test/railties/mounted_engine_test.rb @@ -34,7 +34,6 @@ module ApplicationTests end RUBY - @simple_plugin.write "lib/weblog.rb", <<-RUBY module Weblog class Engine < ::Rails::Engine @@ -239,7 +238,6 @@ module ApplicationTests get "/metrics/generate_blog_route_in_view", {}, "SCRIPT_NAME" => "/foo" assert_equal "/foo/anonymous/blog/posts/1", last_response.body - # test generating application's route from engine with default_url_options get "/someone/blog/generate_application_route", {}, "SCRIPT_NAME" => "/foo" assert_equal "/foo/", last_response.body