Merge pull request #26077 from kamipo/add_stype_empty_lines

Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty lines
This commit is contained in:
Xavier Noria 2016-08-07 11:48:29 +02:00 committed by GitHub
commit fb98d2e571
76 changed files with 4 additions and 90 deletions

View File

@ -20,6 +20,10 @@ Style/BracesAroundHashParameters:
Style/CaseIndentation: Style/CaseIndentation:
Enabled: true Enabled: true
# No extra empty lines.
Style/EmptyLines:
Enabled: true
# In a regular class definition, no empty lines around the body. # In a regular class definition, no empty lines around the body.
Style/EmptyLinesAroundClassBody: Style/EmptyLinesAroundClassBody:
Enabled: true Enabled: true

View File

@ -177,7 +177,6 @@ module ActionCable
end end
end end
protected protected
# Called once a consumer has become a subscriber of the channel. Usually the place to setup any streams # 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. # you want this channel to be sending to the subscriber.

View File

@ -23,7 +23,6 @@ module CommonSubscriptionAdapterTest
[@rx_adapter, @tx_adapter].uniq.each(&:shutdown) [@rx_adapter, @tx_adapter].uniq.each(&:shutdown)
end end
def subscribe_as_queue(channel, adapter = @rx_adapter) def subscribe_as_queue(channel, adapter = @rx_adapter)
queue = Queue.new queue = Queue.new
@ -41,7 +40,6 @@ module CommonSubscriptionAdapterTest
adapter.unsubscribe(channel, callback) if subscribed.set? adapter.unsubscribe(channel, callback) if subscribed.set?
end end
def test_subscribe_and_unsubscribe def test_subscribe_and_unsubscribe
subscribe_as_queue("channel") do |queue| subscribe_as_queue("channel") do |queue|
end end

View File

@ -380,7 +380,6 @@ class BaseTest < ActiveSupport::TestCase
end end
end end
test "implicit multipart with several view paths uses the first one with template" do test "implicit multipart with several view paths uses the first one with template" do
old = BaseMailer.view_paths old = BaseMailer.view_paths
begin begin

View File

@ -6,7 +6,6 @@
require "racc/parser.rb" require "racc/parser.rb"
require "action_dispatch/journey/parser_extras" require "action_dispatch/journey/parser_extras"
module ActionDispatch module ActionDispatch
module Journey module Journey

View File

@ -134,7 +134,6 @@ module ActionDispatch
opts opts
end end
%w(edit new).each do |action| %w(edit new).each do |action|
module_eval <<-EOT, __FILE__, __LINE__ + 1 module_eval <<-EOT, __FILE__, __LINE__ + 1
def #{action}_polymorphic_url(record_or_hash, options = {}) def #{action}_polymorphic_url(record_or_hash, options = {})
@ -211,7 +210,6 @@ module ActionDispatch
method, args = builder.handle_model record_or_hash_or_array method, args = builder.handle_model record_or_hash_or_array
end end
if options.empty? if options.empty?
recipient.send(method, *args) recipient.send(method, *args)
else else

View File

@ -247,7 +247,6 @@ module ActionController
end end
end end
class ::ApplicationController < ActionController::Base class ::ApplicationController < ActionController::Base
end end

View File

@ -277,7 +277,6 @@ CACHED
@store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached")}") @store.read("views/test.host/functional_caching/formatted_fragment_cached/#{template_digest("functional_caching/formatted_fragment_cached")}")
end end
def test_fragment_caching_with_variant def test_fragment_caching_with_variant
get :formatted_fragment_cached_with_variant, format: "html", params: { v: :phone } get :formatted_fragment_cached_with_variant, format: "html", params: { v: :phone }
assert_response :success assert_response :success

View File

@ -247,7 +247,6 @@ class HelperTest < ActiveSupport::TestCase
end end
end end
class IsolatedHelpersTest < ActionController::TestCase class IsolatedHelpersTest < ActionController::TestCase
class A < ActionController::Base class A < ActionController::Base
def index def index

View File

@ -51,7 +51,6 @@ class RespondToController < ActionController::Base
end end
end end
def forced_xml def forced_xml
request.format = :xml request.format = :xml
@ -109,7 +108,6 @@ class RespondToController < ActionController::Base
end end
end end
def custom_constant_handling def custom_constant_handling
respond_to do |type| respond_to do |type|
type.html { render body: "HTML" } type.html { render body: "HTML" }

View File

@ -86,7 +86,6 @@ class RenderJsonTest < ActionController::TestCase
assert_equal "[]", @response.body assert_equal "[]", @response.body
end end
def test_render_json def test_render_json
get :render_json_hello_world get :render_json_hello_world
assert_equal '{"hello":"world"}', @response.body assert_equal '{"hello":"world"}', @response.body

View File

@ -99,7 +99,6 @@ class PrependProtectForgeryBaseController < ActionController::Base
@called_callbacks << name @called_callbacks << name
end end
def custom_action def custom_action
add_called_callback("custom_action") add_called_callback("custom_action")
end end

View File

@ -159,7 +159,6 @@ class SendFileTest < ActionController::TestCase
assert_equal "image/png", response.content_type assert_equal "image/png", response.content_type
end end
def test_send_file_headers_with_bad_symbol def test_send_file_headers_with_bad_symbol
error = assert_raise(ArgumentError) { get __method__ } error = assert_raise(ArgumentError) { get __method__ }
assert_equal "Unknown MIME type this_type_is_not_registered", error.message assert_equal "Unknown MIME type this_type_is_not_registered", error.message

View File

@ -50,7 +50,6 @@ class RequestIdResponseTest < ActionDispatch::IntegrationTest
end end
end end
private private
def with_test_route_set def with_test_route_set

View File

@ -1069,7 +1069,6 @@ class RequestParameters < BaseRequestTest
end end
end end
class RequestParameterFilter < BaseRequestTest class RequestParameterFilter < BaseRequestTest
test "process parameter filter" do test "process parameter filter" do
test_hashes = [ test_hashes = [

View File

@ -338,7 +338,6 @@ module ActionDispatch
" DELETE /admin/posts/:id(.:format) admin/posts#destroy"], output " DELETE /admin/posts/:id(.:format) admin/posts#destroy"], output
end end
def test_regression_route_with_controller_regexp def test_regression_route_with_controller_regexp
output = draw do output = draw do
ActiveSupport::Deprecation.silence do ActiveSupport::Deprecation.silence do

View File

@ -82,7 +82,6 @@ module StaticTests
assert_html "means hello in Japanese\n", get("/foo/#{Rack::Utils.escape("こんにちは.html")}") assert_html "means hello in Japanese\n", get("/foo/#{Rack::Utils.escape("こんにちは.html")}")
end end
def test_serves_static_file_with_exclamation_mark_in_filename def test_serves_static_file_with_exclamation_mark_in_filename
with_static_file "/foo/foo!bar.html" do |file| with_static_file "/foo/foo!bar.html" do |file|
assert_html file, get("/foo/foo%21bar.html") assert_html file, get("/foo/foo%21bar.html")

View File

@ -105,7 +105,6 @@ module ActionView
attr_reader :name, :template attr_reader :name, :template
private :name, :template private :name, :template
private private
def source def source
template.source template.source

View File

@ -24,7 +24,6 @@ unless defined?(ActiveRecord) && defined?(FixtureSet)
end end
$stderr.flush $stderr.flush
# Define the rest of the connector # Define the rest of the connector
class ActiveRecordTestConnector class ActiveRecordTestConnector
class << self class << self

View File

@ -1318,7 +1318,6 @@ class DateHelperTest < ActionView::TestCase
expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n) expected << %(<option value="2003" selected="selected">2003</option>\n<option value="2004">2004</option>\n<option value="2005">2005</option>\n)
expected << "</select>\n" expected << "</select>\n"
expected << %(<select id="date_first_month" name="date[first][month]" class="selector">\n) expected << %(<select id="date_first_month" name="date[first][month]" class="selector">\n)
expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n) expected << %(<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option value="6">June</option>\n<option value="7">July</option>\n<option value="8" selected="selected">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n)
expected << "</select>\n" expected << "</select>\n"
@ -1953,7 +1952,6 @@ class DateHelperTest < ActionView::TestCase
concat f.date_select(:written_on) concat f.date_select(:written_on)
end end
expected = %{<select id="post_#{id}_written_on_1i" name="post[#{id}][written_on(1i)]">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n} expected = %{<select id="post_#{id}_written_on_1i" name="post[#{id}][written_on(1i)]">\n<option value="1999">1999</option>\n<option value="2000">2000</option>\n<option value="2001">2001</option>\n<option value="2002">2002</option>\n<option value="2003">2003</option>\n<option selected="selected" value="2004">2004</option>\n<option value="2005">2005</option>\n<option value="2006">2006</option>\n<option value="2007">2007</option>\n<option value="2008">2008</option>\n<option value="2009">2009</option>\n</select>\n}
expected << %{<select id="post_#{id}_written_on_2i" name="post[#{id}][written_on(2i)]">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n} expected << %{<select id="post_#{id}_written_on_2i" name="post[#{id}][written_on(2i)]">\n<option value="1">January</option>\n<option value="2">February</option>\n<option value="3">March</option>\n<option value="4">April</option>\n<option value="5">May</option>\n<option selected="selected" value="6">June</option>\n<option value="7">July</option>\n<option value="8">August</option>\n<option value="9">September</option>\n<option value="10">October</option>\n<option value="11">November</option>\n<option value="12">December</option>\n</select>\n}
expected << %{<select id="post_#{id}_written_on_3i" name="post[#{id}][written_on(3i)]">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n} expected << %{<select id="post_#{id}_written_on_3i" name="post[#{id}][written_on(3i)]">\n<option value="1">1</option>\n<option value="2">2</option>\n<option value="3">3</option>\n<option value="4">4</option>\n<option value="5">5</option>\n<option value="6">6</option>\n<option value="7">7</option>\n<option value="8">8</option>\n<option value="9">9</option>\n<option value="10">10</option>\n<option value="11">11</option>\n<option value="12">12</option>\n<option value="13">13</option>\n<option value="14">14</option>\n<option selected="selected" value="15">15</option>\n<option value="16">16</option>\n<option value="17">17</option>\n<option value="18">18</option>\n<option value="19">19</option>\n<option value="20">20</option>\n<option value="21">21</option>\n<option value="22">22</option>\n<option value="23">23</option>\n<option value="24">24</option>\n<option value="25">25</option>\n<option value="26">26</option>\n<option value="27">27</option>\n<option value="28">28</option>\n<option value="29">29</option>\n<option value="30">30</option>\n<option value="31">31</option>\n</select>\n}

View File

@ -2257,7 +2257,6 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer assert_dom_equal expected, output_buffer
end end
def test_nested_fields_for_with_nested_collections def test_nested_fields_for_with_nested_collections
form_for(@post, as: "post[]") do |f| form_for(@post, as: "post[]") do |f|
concat f.text_field(:title) concat f.text_field(:title)

View File

@ -57,7 +57,6 @@ class FormOptionsHelperTest < ActionView::TestCase
) )
end end
def test_collection_options_with_preselected_value def test_collection_options_with_preselected_value
assert_dom_equal( assert_dom_equal(
"<option value=\"&lt;Abe&gt;\">&lt;Abe&gt; went home</option>\n<option value=\"Babe\" selected=\"selected\">Babe went home</option>\n<option value=\"Cabe\">Cabe went home</option>", "<option value=\"&lt;Abe&gt;\">&lt;Abe&gt; went home</option>\n<option value=\"Babe\" selected=\"selected\">Babe went home</option>\n<option value=\"Cabe\">Cabe went home</option>",

View File

@ -517,7 +517,6 @@ class FormTagHelperTest < ActionView::TestCase
) )
end end
def test_button_tag def test_button_tag
assert_dom_equal( assert_dom_equal(
%(<button name="button" type="submit">Button</button>), %(<button name="button" type="submit">Button</button>),

View File

@ -2,7 +2,6 @@ require "helper"
require "jobs/hello_job" require "jobs/hello_job"
require "active_support/core_ext/numeric/time" require "active_support/core_ext/numeric/time"
class QueuingTest < ActiveSupport::TestCase class QueuingTest < ActiveSupport::TestCase
setup do setup do
JobBuffer.clear JobBuffer.clear
@ -32,7 +31,6 @@ class QueuingTest < ActiveSupport::TestCase
assert_equal [ "Jamie" ], job.arguments assert_equal [ "Jamie" ], job.arguments
end end
test "job returned by perform_at has the timestamp available" do test "job returned by perform_at has the timestamp available" do
begin begin
job = HelloJob.set(wait_until: Time.utc(2014, 1, 1)).perform_later job = HelloJob.set(wait_until: Time.utc(2014, 1, 1)).perform_later

View File

@ -17,7 +17,6 @@ class CallbackJob < ActiveJob::Base
job.history << "CallbackJob ran around_enqueue_stop" job.history << "CallbackJob ran around_enqueue_stop"
end end
def perform(person = "david") def perform(person = "david")
# NOTHING! # NOTHING!
end end

View File

@ -12,7 +12,6 @@ module Sneakers
end end
end end
module SneakersJobsManager module SneakersJobsManager
def setup def setup
ActiveJob::Base.queue_adapter = :sneakers ActiveJob::Base.queue_adapter = :sneakers

View File

@ -71,7 +71,6 @@ class DogValidatorWithIfCondition < Dog
def set_after_validation_marker2; self.history << "after_validation_marker2" ; end def set_after_validation_marker2; self.history << "after_validation_marker2" ; end
end end
class CallbacksWithMethodNamesShouldBeCalled < ActiveModel::TestCase class CallbacksWithMethodNamesShouldBeCalled < ActiveModel::TestCase
def test_if_condition_is_respected_for_before_validation def test_if_condition_is_respected_for_before_validation
d = DogValidatorWithIfCondition.new d = DogValidatorWithIfCondition.new

View File

@ -336,7 +336,6 @@ class LengthValidationTest < ActiveModel::TestCase
assert_equal ["Your essay must be at least 5 words."], t.errors[:content] assert_equal ["Your essay must be at least 5 words."], t.errors[:content]
end end
def test_validates_length_of_with_symbol def test_validates_length_of_with_symbol
assert_deprecated do assert_deprecated do
Topic.validates_length_of( Topic.validates_length_of(

View File

@ -79,7 +79,6 @@ module ActiveRecord
end end
end end
def through_scope def through_scope
scope = through_reflection.klass.unscoped scope = through_reflection.klass.unscoped

View File

@ -35,7 +35,6 @@ module ActiveRecord
alias table_exists? data_source_exists? alias table_exists? data_source_exists?
deprecate table_exists?: "use #data_source_exists? instead" deprecate table_exists?: "use #data_source_exists? instead"
# Add internal cache for table with +table_name+. # Add internal cache for table with +table_name+.
def add(table_name) def add(table_name)
if data_source_exists?(table_name) if data_source_exists?(table_name)

View File

@ -184,7 +184,6 @@ module ActiveRecord
end end
end end
# In de/serialize we change `nil` to 0, so that we can allow passing # 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` # `nil` values to `lock_version`, and not result in `ActiveRecord::StaleObjectError`
# during update record. # during update record.

View File

@ -23,7 +23,6 @@ module ActiveRecord
"ActiveRecord::RecordNotSaved" => :unprocessable_entity "ActiveRecord::RecordNotSaved" => :unprocessable_entity
) )
config.active_record.use_schema_cache_dump = true config.active_record.use_schema_cache_dump = true
config.active_record.maintain_test_schema = true config.active_record.maintain_test_schema = true

View File

@ -317,7 +317,6 @@ module ActiveRecord
end end
end end
# Holds all the meta-data about an aggregation as it was specified in the # Holds all the meta-data about an aggregation as it was specified in the
# Active Record class. # Active Record class.
class AggregateReflection < MacroReflection #:nodoc: class AggregateReflection < MacroReflection #:nodoc:

View File

@ -92,7 +92,6 @@ module ActiveRecord
end end
end end
def create_binds_for_hash(attributes) def create_binds_for_hash(attributes)
result = attributes.dup result = attributes.dup
binds = [] binds = []

View File

@ -1,7 +1,6 @@
require "cases/helper" require "cases/helper"
require "support/ddl_helper" require "support/ddl_helper"
class PostgresqlTime < ActiveRecord::Base class PostgresqlTime < ActiveRecord::Base
end end

View File

@ -137,7 +137,6 @@ class AssociationCallbacksTest < ActiveRecord::TestCase
assert_equal "after_adding<new>", ar.developers_log.last assert_equal "after_adding<new>", ar.developers_log.last
end end
def test_has_and_belongs_to_many_remove_callback def test_has_and_belongs_to_many_remove_callback
david = developers(:david) david = developers(:david)
jamis = developers(:jamis) jamis = developers(:jamis)

View File

@ -58,8 +58,6 @@ class NonPolyTwo < ActiveRecord::Base
include Remembered include Remembered
end end
class EagerLoadPolyAssocsTest < ActiveRecord::TestCase class EagerLoadPolyAssocsTest < ActiveRecord::TestCase
NUM_SIMPLE_OBJS = 50 NUM_SIMPLE_OBJS = 50
NUM_SHAPE_EXPRESSIONS = 100 NUM_SHAPE_EXPRESSIONS = 100

View File

@ -1,6 +1,5 @@
require "cases/helper" require "cases/helper"
if ActiveRecord::Base.connection.supports_migrations? if ActiveRecord::Base.connection.supports_migrations?
class EagerSingularizationTest < ActiveRecord::TestCase class EagerSingularizationTest < ActiveRecord::TestCase
class Virus < ActiveRecord::Base class Virus < ActiveRecord::Base

View File

@ -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" assert_equal m.name, f.man.name, "Name of man should be the same after changes to child-owned instance"
end end
def test_parent_instance_should_be_shared_with_eager_loaded_child_on_find def test_parent_instance_should_be_shared_with_eager_loaded_child_on_find
m = Man.all.merge!(where: {name: "Gordon"}, includes: :face).first m = Man.all.merge!(where: {name: "Gordon"}, includes: :face).first
f = m.face f = m.face

View File

@ -472,7 +472,6 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase
assert new_tag.persisted? assert new_tag.persisted?
assert saved_post.reload.tags.reload.include?(new_tag) assert saved_post.reload.tags.reload.include?(new_tag)
new_post = Post.new(title: "Association replacement works!", body: "You best believe it.") new_post = Post.new(title: "Association replacement works!", body: "You best believe it.")
saved_tag = tags(:general) saved_tag = tags(:general)

View File

@ -56,7 +56,6 @@ class AssociationsTest < ActiveRecord::TestCase
assert_equal "Deck", ship.parts[0].name assert_equal "Deck", ship.parts[0].name
end end
def test_include_with_order_works 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}
assert_nothing_raised {Account.all.merge!(order: :id, includes: :firm).first} assert_nothing_raised {Account.all.merge!(order: :id, includes: :firm).first}

View File

@ -134,7 +134,6 @@ class DirtyTest < ActiveRecord::TestCase
end end
end end
def test_aliased_attribute_changes def test_aliased_attribute_changes
# the actual attribute here is name, title is an # the actual attribute here is name, title is an
# alias setup via alias_attribute # alias setup via alias_attribute
@ -408,7 +407,6 @@ class DirtyTest < ActiveRecord::TestCase
assert !pirate.changed? assert !pirate.changed?
end end
def test_reverted_changes_are_not_dirty_going_from_nil_to_value_and_back def test_reverted_changes_are_not_dirty_going_from_nil_to_value_and_back
pirate = Pirate.create!(catchphrase: "Yar!") pirate = Pirate.create!(catchphrase: "Yar!")

View File

@ -479,7 +479,6 @@ class SetupSubclassTest < SetupTest
end end
end end
class OverlappingFixturesTest < ActiveRecord::TestCase class OverlappingFixturesTest < ActiveRecord::TestCase
fixtures :topics, :developers fixtures :topics, :developers
fixtures :developers, :accounts fixtures :developers, :accounts

View File

@ -374,7 +374,6 @@ class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
end end
end end
# TODO: test against the generated SQL since testing locking behavior itself # TODO: test against the generated SQL since testing locking behavior itself
# is so cumbersome. Will deadlock Ruby threads if the underlying db.execute # is so cumbersome. Will deadlock Ruby threads if the underlying db.execute
# blocks, so separate script called by Kernel#system is needed. # blocks, so separate script called by Kernel#system is needed.

View File

@ -49,7 +49,6 @@ module ActiveRecord
assert connection.index_name_exists?(table_name, "old_idx", false) assert connection.index_name_exists?(table_name, "old_idx", false)
end end
def test_double_add_index def test_double_add_index
connection.add_index(table_name, [:foo], name: "some_idx") connection.add_index(table_name, [:foo], name: "some_idx")
assert_raises(ArgumentError) { assert_raises(ArgumentError) {

View File

@ -401,7 +401,6 @@ class MigrationTest < ActiveRecord::TestCase
ENV["RACK_ENV"] = original_rack_env ENV["RACK_ENV"] = original_rack_env
end end
def test_migration_sets_internal_metadata_even_when_fully_migrated def test_migration_sets_internal_metadata_even_when_fully_migrated
current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call current_env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
migrations_path = MIGRATIONS_ROOT + "/valid" migrations_path = MIGRATIONS_ROOT + "/valid"

View File

@ -35,7 +35,6 @@ class ReadOnlyTest < ActiveRecord::TestCase
assert_equal "Developer is marked as readonly", e.message assert_equal "Developer is marked as readonly", e.message
end end
def test_find_with_readonly_option def test_find_with_readonly_option
Developer.all.each { |d| assert !d.readonly? } Developer.all.each { |d| assert !d.readonly? }
Developer.readonly(false).each { |d| assert !d.readonly? } Developer.readonly(false).each { |d| assert !d.readonly? }

View File

@ -132,7 +132,6 @@ module ActiveRecord
assert_equal "title DESC", relation.order_values.first assert_equal "title DESC", relation.order_values.first
assert_equal "comments_count ASC", relation.order_values.last assert_equal "comments_count ASC", relation.order_values.last
relation.reverse_order! relation.reverse_order!
assert_equal "title ASC", relation.order_values.first assert_equal "title ASC", relation.order_values.first

View File

@ -953,7 +953,6 @@ class RelationTest < ActiveRecord::TestCase
} }
end end
def test_find_all_using_where_with_relation_with_select_to_build_subquery def test_find_all_using_where_with_relation_with_select_to_build_subquery
david = authors(:david) david = authors(:david)
assert_queries(1) { assert_queries(1) {

View File

@ -25,7 +25,6 @@ module ActiveRecord
assert_equal "my other book", b[0].name assert_equal "my other book", b[0].name
end end
def test_statement_cache_id def test_statement_cache_id
b1 = Book.create(name: "my book") b1 = Book.create(name: "my book")
b2 = Book.create(name: "my other book") b2 = Book.create(name: "my other book")

View File

@ -449,7 +449,6 @@ class CallbacksOnMultipleActionsTest < ActiveRecord::TestCase
end end
end end
class TransactionEnrollmentCallbacksTest < ActiveRecord::TestCase class TransactionEnrollmentCallbacksTest < ActiveRecord::TestCase
class TopicWithoutTransactionalEnrollmentCallbacks < ActiveRecord::Base class TopicWithoutTransactionalEnrollmentCallbacks < ActiveRecord::Base
self.table_name = :topics self.table_name = :topics

View File

@ -12,7 +12,6 @@ class LengthValidationTest < ActiveRecord::TestCase
end end
end end
def test_validates_size_of_association def test_validates_size_of_association
assert_nothing_raised { @owner.validates_size_of :pets, minimum: 1 } assert_nothing_raised { @owner.validates_size_of :pets, minimum: 1 }
o = @owner.new("name" => "nopets") o = @owner.new("name" => "nopets")

View File

@ -60,7 +60,6 @@ class PersonWithDependentNullifyJobs < ActiveRecord::Base
has_many :jobs, source: :job, through: :references, dependent: :nullify has_many :jobs, source: :job, through: :references, dependent: :nullify
end end
class LoosePerson < ActiveRecord::Base class LoosePerson < ActiveRecord::Base
self.table_name = "people" self.table_name = "people"
self.abstract_class = true self.abstract_class = true

View File

@ -13,7 +13,6 @@ module ActiveSupport
# we need exclusive locks to be reentrant, and we need to be able # we need exclusive locks to be reentrant, and we need to be able
# to upgrade share locks to exclusive. # to upgrade share locks to exclusive.
def raw_state # :nodoc: def raw_state # :nodoc:
synchronize do synchronize do
threads = @sleeping.keys | @sharing.keys | @waiting.keys threads = @sleeping.keys | @sharing.keys | @waiting.keys

View File

@ -161,7 +161,6 @@ module ActiveSupport
alias_method :has_key?, :key? alias_method :has_key?, :key?
alias_method :member?, :key? alias_method :member?, :key?
# Same as <tt>Hash#[]</tt> where the key passed as argument can be # Same as <tt>Hash#[]</tt> where the key passed as argument can be
# either a string or a symbol: # either a string or a symbol:
# #

View File

@ -66,7 +66,6 @@ module ActiveSupport
alias :assert_not_respond_to :refute_respond_to alias :assert_not_respond_to :refute_respond_to
alias :assert_not_same :refute_same alias :assert_not_same :refute_same
# Assertion that the block should not raise an exception. # Assertion that the block should not raise an exception.
# #
# Passes if evaluated code in the yielded block raises no exception. # Passes if evaluated code in the yielded block raises no exception.

View File

@ -181,8 +181,6 @@ module CallbacksTest
end end
end end
class ConditionalPerson < Record class ConditionalPerson < Record
# proc # proc
before_save Proc.new { |r| r.history << [:before_save, :proc] }, if: Proc.new { |r| true } before_save Proc.new { |r| r.history << [:before_save, :proc] }, if: Proc.new { |r| true }
@ -489,8 +487,6 @@ module CallbacksTest
end end
end end
class ResetCallbackTest < ActiveSupport::TestCase class ResetCallbackTest < ActiveSupport::TestCase
def test_save_conditional_person def test_save_conditional_person
person = CleanPerson.new person = CleanPerson.new

View File

@ -276,7 +276,6 @@ class HashExtTest < ActiveSupport::TestCase
assert_equal @nested_symbols, @nested_mixed.with_indifferent_access.deep_symbolize_keys assert_equal @nested_symbols, @nested_mixed.with_indifferent_access.deep_symbolize_keys
end end
def test_symbolize_keys_bang_for_hash_with_indifferent_access def test_symbolize_keys_bang_for_hash_with_indifferent_access
assert_raise(NoMethodError) { @symbols.with_indifferent_access.dup.symbolize_keys! } assert_raise(NoMethodError) { @symbols.with_indifferent_access.dup.symbolize_keys! }
assert_raise(NoMethodError) { @strings.with_indifferent_access.dup.symbolize_keys! } assert_raise(NoMethodError) { @strings.with_indifferent_access.dup.symbolize_keys! }

View File

@ -1,7 +1,6 @@
require "abstract_unit" require "abstract_unit"
require "active_support/core_ext/load_error" require "active_support/core_ext/load_error"
class TestMissingSourceFile < ActiveSupport::TestCase class TestMissingSourceFile < ActiveSupport::TestCase
def test_it_is_deprecated def test_it_is_deprecated
assert_deprecated do assert_deprecated do

View File

@ -509,7 +509,6 @@ class MethodAliasingTest < ActiveSupport::TestCase
assert_respond_to @instance, :quux_with_baz? assert_respond_to @instance, :quux_with_baz?
assert_respond_to @instance, :quux_with_baz= assert_respond_to @instance, :quux_with_baz=
FooClassWithBarMethod.alias_method_chain :quux!, :baz FooClassWithBarMethod.alias_method_chain :quux!, :baz
assert_equal "quux!_with_baz", @instance.quux! assert_equal "quux!_with_baz", @instance.quux!
assert_equal "quux!", @instance.quux_without_baz! assert_equal "quux!", @instance.quux_without_baz!

View File

@ -176,7 +176,6 @@ class NumericExtFormattingTest < ActiveSupport::TestCase
assert_equal("&pound;1234567890,50", 1234567890.50.to_s(:currency, unit: "&pound;", separator: ",", delimiter: "")) assert_equal("&pound;1234567890,50", 1234567890.50.to_s(:currency, unit: "&pound;", separator: ",", delimiter: ""))
end end
def test_to_s__rounded def test_to_s__rounded
assert_equal("-111.235", -111.2346.to_s(:rounded)) assert_equal("-111.235", -111.2346.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: ",") assert_equal "12.345.678,05", 12345678.05.to_s(:delimited, delimiter: ".", separator: ",")
end end
def test_to_s__rounded_with_custom_delimiter_and_separator def test_to_s__rounded_with_custom_delimiter_and_separator
assert_equal "31,83", 31.825.to_s(:rounded, precision: 2, 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: ".") assert_equal "1.231,83", 1231.825.to_s(:rounded, precision: 2, separator: ",", delimiter: ".")

View File

@ -1036,7 +1036,6 @@ class DependenciesTest < ActiveSupport::TestCase
remove_constants(:A) remove_constants(:A)
end end
def test_autoload_once_paths_should_behave_when_recursively_loading def test_autoload_once_paths_should_behave_when_recursively_loading
old_path = ActiveSupport::Dependencies.autoload_once_paths old_path = ActiveSupport::Dependencies.autoload_once_paths
with_loading "dependencies", "autoloading_fixtures" do with_loading "dependencies", "autoloading_fixtures" do

View File

@ -35,7 +35,6 @@ class Deprecatee
A = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Deprecatee::A", "Deprecatee::B::C") A = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Deprecatee::A", "Deprecatee::B::C")
end end
class DeprecationTest < ActiveSupport::TestCase class DeprecationTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Stream include ActiveSupport::Testing::Stream

View File

@ -80,7 +80,6 @@ module FileUpdateCheckerSharedTests
assert_equal 1, i assert_equal 1, i
end end
test "updated should become true when watched files are created" do test "updated should become true when watched files are created" do
i = 0 i = 0
@ -92,7 +91,6 @@ module FileUpdateCheckerSharedTests
assert checker.updated? assert checker.updated?
end end
test "updated should become true when watched files are modified" do test "updated should become true when watched files are modified" do
i = 0 i = 0

View File

@ -80,7 +80,6 @@ class InflectorTest < ActiveSupport::TestCase
end end
end end
def test_overwrite_previous_inflectors def test_overwrite_previous_inflectors
assert_equal("series", ActiveSupport::Inflector.singularize("series")) assert_equal("series", ActiveSupport::Inflector.singularize("series"))
ActiveSupport::Inflector.inflections.singular "series", "serie" ActiveSupport::Inflector.inflections.singular "series", "serie"

View File

@ -306,7 +306,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
user_birthday = Struct::UserNameAndDate.new "David", Date.new(2010, 01, 01) user_birthday = Struct::UserNameAndDate.new "David", Date.new(2010, 01, 01)
custom = Struct::Custom.new "David", user_birthday custom = Struct::Custom.new "David", user_birthday
json_strings = "" json_strings = ""
json_string_and_date = "" json_string_and_date = ""
json_custom = "" json_custom = ""

View File

@ -1,6 +1,5 @@
require "abstract_unit" require "abstract_unit"
class MultibyteUnicodeDatabaseTest < ActiveSupport::TestCase class MultibyteUnicodeDatabaseTest < ActiveSupport::TestCase
include ActiveSupport::Multibyte::Unicode include ActiveSupport::Multibyte::Unicode

View File

@ -97,7 +97,6 @@ class CoolStargate < Stargate
end end
end end
class RescuableTest < ActiveSupport::TestCase class RescuableTest < ActiveSupport::TestCase
def setup def setup
@stargate = Stargate.new @stargate = Stargate.new

View File

@ -3,7 +3,6 @@ if RUBY_PLATFORM.include?("java")
require "active_support/xml_mini" require "active_support/xml_mini"
require "active_support/core_ext/hash/conversions" require "active_support/core_ext/hash/conversions"
class JDOMEngineTest < ActiveSupport::TestCase class JDOMEngineTest < ActiveSupport::TestCase
include ActiveSupport include ActiveSupport
@ -56,7 +55,6 @@ if RUBY_PLATFORM.include?("java")
end end
end end
def test_not_allowed_to_load_external_doctypes def test_not_allowed_to_load_external_doctypes
attack_xml = <<-EOT attack_xml = <<-EOT
<!DOCTYPE member SYSTEM "file://#{FILES_DIR}/jdom_doctype.dtd"> <!DOCTYPE member SYSTEM "file://#{FILES_DIR}/jdom_doctype.dtd">

View File

@ -191,7 +191,6 @@ else
eoxml eoxml
end end
private private
def assert_equal_rexml(xml) def assert_equal_rexml(xml)
parsed_xml = XmlMini.parse(xml) parsed_xml = XmlMini.parse(xml)

View File

@ -274,7 +274,6 @@ module Rails
end end
end end
# Runs the supplied command using either "rake ..." or "rails ..." # Runs the supplied command using either "rake ..." or "rails ..."
# based on the executor parameter provided. # based on the executor parameter provided.
def execute_command(executor, command, options={}) def execute_command(executor, command, options={})

View File

@ -666,7 +666,6 @@ module ApplicationTests
end end
RUBY RUBY
app_file "app/controllers/posts_controller.rb", <<-RUBY app_file "app/controllers/posts_controller.rb", <<-RUBY
class PostsController < ApplicationController class PostsController < ApplicationController
def index def index

View File

@ -40,7 +40,6 @@ class Rails::ConsoleTest < ActiveSupport::TestCase
def test_start_with_sandbox def test_start_with_sandbox
start ["--sandbox"] start ["--sandbox"]
assert app.console.started? assert app.console.started?
assert app.sandbox assert app.sandbox
assert_match(/Loading \w+ environment in sandbox \(Rails/, output) assert_match(/Loading \w+ environment in sandbox \(Rails/, output)

View File

@ -618,7 +618,6 @@ class PluginGeneratorTest < Rails::Generators::TestCase
end end
end end
def test_api_generators_configuration_for_api_engines def test_api_generators_configuration_for_api_engines
run_generator [destination_root, "--full", "--api"] run_generator [destination_root, "--full", "--api"]

View File

@ -1226,7 +1226,6 @@ YAML
end end
RUBY RUBY
app_file "config/routes.rb", <<-RUBY app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do Rails.application.routes.draw do
mount Bukkits::Engine => "/" mount Bukkits::Engine => "/"
@ -1276,7 +1275,6 @@ YAML
end end
RUBY RUBY
@plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY @plugin.write "app/controllers/bukkits/bukkit_controller.rb", <<-RUBY
class Bukkits::BukkitController < ActionController::Base class Bukkits::BukkitController < ActionController::Base
def index def index

View File

@ -34,7 +34,6 @@ module ApplicationTests
end end
RUBY RUBY
@simple_plugin.write "lib/weblog.rb", <<-RUBY @simple_plugin.write "lib/weblog.rb", <<-RUBY
module Weblog module Weblog
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
@ -239,7 +238,6 @@ module ApplicationTests
get "/metrics/generate_blog_route_in_view", {}, "SCRIPT_NAME" => "/foo" get "/metrics/generate_blog_route_in_view", {}, "SCRIPT_NAME" => "/foo"
assert_equal "/foo/anonymous/blog/posts/1", last_response.body assert_equal "/foo/anonymous/blog/posts/1", last_response.body
# test generating application's route from engine with default_url_options # test generating application's route from engine with default_url_options
get "/someone/blog/generate_application_route", {}, "SCRIPT_NAME" => "/foo" get "/someone/blog/generate_application_route", {}, "SCRIPT_NAME" => "/foo"
assert_equal "/foo/", last_response.body assert_equal "/foo/", last_response.body