Skip to content

Commit

Permalink
Replace more ableist language
Browse files Browse the repository at this point in the history
Along the same lines as ccb3cb5, this commit removes unnecessary
references to mental health.

As in that commit, I think many of these are more descriptive than what
we had before.

The commit changes only tests and documentation.
  • Loading branch information
composerinteralia committed Oct 7, 2021
1 parent ab3c1c6 commit 2635106
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 37 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_case.rb
Expand Up @@ -627,7 +627,7 @@ def document_root_element
end

def check_required_ivars
# Sanity check for required instance variables so we can give an
# Check for required instance variables so we can give an
# understandable error message.
[:@routes, :@controller, :@request, :@response].each do |iv_name|
if !instance_variable_defined?(iv_name) || instance_variable_get(iv_name).nil?
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/system_testing/driver_test.rb
Expand Up @@ -160,7 +160,7 @@ class DriverTest < ActiveSupport::TestCase
end

test "does not configure browser if driver is not :selenium" do
# sanity check
# Check that it does configure browser if the driver is :selenium
assert ActionDispatch::SystemTesting::Driver.new(:selenium).instance_variable_get(:@browser)

assert_nil ActionDispatch::SystemTesting::Driver.new(:rack_test).instance_variable_get(:@browser)
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/dispatch/test_request_test.rb
Expand Up @@ -3,7 +3,7 @@
require "abstract_unit"

class TestRequestTest < ActiveSupport::TestCase
test "sane defaults" do
test "reasonable defaults" do
env = ActionDispatch::TestRequest.create.env

assert_equal "GET", env.delete("REQUEST_METHOD")
Expand Down
2 changes: 1 addition & 1 deletion activemodel/test/cases/attribute_test.rb
Expand Up @@ -225,7 +225,7 @@ def assert_valid_value(*)
changed = attribute.with_value_from_user("foo")
forgotten = changed.forgetting_assignment

assert changed.changed? # sanity check
assert changed.changed? # Check to avoid a false positive
assert_not_predicate forgotten, :changed?
end

Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/associations/association.rb
Expand Up @@ -295,7 +295,7 @@ def foreign_key_present?

# Raises ActiveRecord::AssociationTypeMismatch unless +record+ is of
# the kind of the class of the associated objects. Meant to be used as
# a sanity check when you are about to assign an associated record.
# a safety check when you are about to assign an associated record.
def raise_on_type_mismatch!(record)
unless record.is_a?(reflection.klass)
fresh_class = reflection.class_name.safe_constantize
Expand Down
Expand Up @@ -141,7 +141,7 @@ def test_statement_key_is_logged
def test_reconnection_after_actual_disconnection_with_verify
original_connection_pid = @connection.query("select pg_backend_pid()")

# Sanity check.
# Double check we are connected to begin with
assert_predicate @connection, :active?

secondary_connection = ActiveRecord::Base.connection_pool.checkout
Expand Down
13 changes: 5 additions & 8 deletions activerecord/test/cases/adapters/postgresql/rename_table_test.rb
Expand Up @@ -14,14 +14,11 @@ def teardown
end

test "renaming a table also renames the primary key index" do
# sanity check
assert_equal 1, num_indices_named("before_rename_pkey")
assert_equal 0, num_indices_named("after_rename_pkey")

@connection.rename_table :before_rename, :after_rename

assert_equal 0, num_indices_named("before_rename_pkey")
assert_equal 1, num_indices_named("after_rename_pkey")
assert_changes(-> { num_indices_named("before_rename_pkey") }, from: 1, to: 0) do
assert_changes(-> { num_indices_named("after_rename_pkey") }, from: 0, to: 1) do
@connection.rename_table :before_rename, :after_rename
end
end
end

private
Expand Down
Expand Up @@ -768,9 +768,9 @@ def test_update_all_on_association_accessed_before_save_with_explicit_foreign_ke
assert_equal firm.clients.count, firm.clients.update_all(description: "Great!")
end

def test_belongs_to_sanity
def test_belongs_to_with_new_object
c = Client.new
assert_nil c.firm, "belongs_to failed sanity check on new object"
assert_nil c.firm, "belongs_to failed on new object"
end

def test_find_ids
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/attribute_methods_test.rb
Expand Up @@ -1085,7 +1085,7 @@ def some_method_that_is_not_on_super
model = @target.select("id").last!

assert_equal ["id"], model.attribute_names
# Sanity check, make sure other columns exist.
# Ensure other columns exist.
assert_not_equal ["id"], @target.column_names
end

Expand Down
22 changes: 11 additions & 11 deletions activerecord/test/cases/autosave_association_test.rb
Expand Up @@ -1290,9 +1290,9 @@ def test_should_still_work_without_an_associated_model
end

def test_should_automatically_save_the_associated_model
@pirate.ship.name = "The Vile Insanity"
@pirate.ship.name = "The Vile Serpent"
@pirate.save
assert_equal "The Vile Insanity", @pirate.reload.ship.name
assert_equal "The Vile Serpent", @pirate.reload.ship.name
end

def test_changed_for_autosave_should_handle_cycles
Expand All @@ -1306,9 +1306,9 @@ def test_changed_for_autosave_should_handle_cycles
end

def test_should_automatically_save_bang_the_associated_model
@pirate.ship.name = "The Vile Insanity"
@pirate.ship.name = "The Vile Serpent"
@pirate.save!
assert_equal "The Vile Insanity", @pirate.reload.ship.name
assert_equal "The Vile Serpent", @pirate.reload.ship.name
end

def test_should_automatically_validate_the_associated_model
Expand Down Expand Up @@ -1376,7 +1376,7 @@ def test_should_still_raise_an_ActiveRecordRecord_Invalid_exception_if_we_want_t

def test_should_not_save_and_return_false_if_a_callback_cancelled_saving
pirate = Pirate.new(catchphrase: "Arr")
ship = pirate.build_ship(name: "The Vile Insanity")
ship = pirate.build_ship(name: "The Vile Serpent")
ship.cancel_save_from_callback = true

assert_no_difference "Pirate.count" do
Expand All @@ -1390,7 +1390,7 @@ def test_should_rollback_any_changes_if_an_exception_occurred_while_saving
before = [@pirate.catchphrase, @pirate.ship.name]

@pirate.catchphrase = "Arr"
@pirate.ship.name = "The Vile Insanity"
@pirate.ship.name = "The Vile Serpent"

# Stub the save method of the @pirate.ship instance to raise an exception
class << @pirate.ship
Expand Down Expand Up @@ -1472,9 +1472,9 @@ def setup

def test_should_still_work_without_an_associated_model
@pirate.destroy
@ship.reload.name = "The Vile Insanity"
@ship.reload.name = "The Vile Serpent"
@ship.save
assert_equal "The Vile Insanity", @ship.reload.name
assert_equal "The Vile Serpent", @ship.reload.name
end

def test_should_automatically_save_the_associated_model
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def test_should_still_raise_an_ActiveRecordRecord_Invalid_exception_if_we_want_t
end

def test_should_not_save_and_return_false_if_a_callback_cancelled_saving
ship = Ship.new(name: "The Vile Insanity")
ship = Ship.new(name: "The Vile Serpent")
pirate = ship.build_pirate(catchphrase: "Arr")
pirate.cancel_save_from_callback = true

Expand All @@ -1538,7 +1538,7 @@ def test_should_rollback_any_changes_if_an_exception_occurred_while_saving
before = [@ship.pirate.catchphrase, @ship.name]

@ship.pirate.catchphrase = "Arr"
@ship.name = "The Vile Insanity"
@ship.name = "The Vile Serpent"

# Stub the save method of the @ship.pirate instance to raise an exception
class << @ship.pirate
Expand All @@ -1553,7 +1553,7 @@ def save(**)
end

def test_should_not_load_the_associated_model
assert_queries(1) { @ship.name = "The Vile Insanity"; @ship.save! }
assert_queries(1) { @ship.name = "The Vile Serpent"; @ship.save! }
end

def test_should_save_with_non_nullable_foreign_keys
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/fixtures_test.rb
Expand Up @@ -473,7 +473,7 @@ def test_empty_yaml_fixture_with_a_comment_in_it
def test_nonexistent_fixture_file
nonexistent_fixture_path = FIXTURES_ROOT + "/imnothere"

# sanity check to make sure that this file never exists
# Ensure that this file never exists
assert_empty Dir[nonexistent_fixture_path + "*"]

assert_raise(Errno::ENOENT) do
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/locking_test.rb
Expand Up @@ -673,7 +673,7 @@ def setup
end

# Test typical find.
def test_sane_find_with_lock
def test_typical_find_with_lock
assert_nothing_raised do
Person.transaction do
Person.lock.find(1)
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/query_cache_test.rb
Expand Up @@ -621,7 +621,7 @@ def test_query_cached_even_when_types_are_reset

def test_query_cache_does_not_establish_connection_if_unconnected
ActiveRecord::Base.clear_active_connections!
assert_not ActiveRecord::Base.connection_handler.active_connections? # sanity check
assert_not ActiveRecord::Base.connection_handler.active_connections? # Double check they are cleared

middleware {
assert_not ActiveRecord::Base.connection_handler.active_connections?, "QueryCache forced ActiveRecord::Base to establish a connection in setup"
Expand All @@ -632,7 +632,7 @@ def test_query_cache_does_not_establish_connection_if_unconnected

def test_query_cache_is_enabled_on_connections_established_after_middleware_runs
ActiveRecord::Base.clear_active_connections!
assert_not ActiveRecord::Base.connection_handler.active_connections? # sanity check
assert_not ActiveRecord::Base.connection_handler.active_connections? # Double check they are cleared

middleware {
assert_predicate ActiveRecord::Base.connection, :query_cache_enabled
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/yaml_serialization_test.rb
Expand Up @@ -61,7 +61,7 @@ def test_cast_types_are_not_changed_on_round_trip
def test_new_records_remain_new_after_round_trip
topic = Topic.new

assert topic.new_record?, "Sanity check that new records are new"
assert topic.new_record?, "New record should be new"
assert yaml_load(YAML.dump(topic)).new_record?, "Record should be new after deserialization"

topic.save!
Expand Down
2 changes: 1 addition & 1 deletion guides/source/asset_pipeline.md
Expand Up @@ -587,7 +587,7 @@ Debug mode can also be enabled in Rails helper methods:

The `:debug` option is redundant if debug mode is already on.

You can also enable compression in development mode as a sanity check, and
You can also enable compression in development mode, and
disable it on-demand as required for debugging.

In Production
Expand Down
2 changes: 1 addition & 1 deletion railties/test/application/rake_test.rb
Expand Up @@ -181,7 +181,7 @@ class Hello
assert_equal "Answer: 42\n", output
end

def test_code_statistics_sanity
def test_code_statistics
assert_match "Code LOC: 61 Test LOC: 3 Code to Test Ratio: 1:0.0",
rails("stats")
end
Expand Down
4 changes: 2 additions & 2 deletions railties/test/generators/migration_generator_test.rb
Expand Up @@ -127,7 +127,7 @@ def test_remove_migration_with_references_removes_foreign_keys
assert_migration "db/migrate/#{migration}.rb" do |content|
assert_method :change, content do |change|
assert_match(/remove_reference :books, :author,.*\sforeign_key: true/, change)
assert_match(/remove_reference :books, :distributor/, change) # sanity check
assert_match(/remove_reference :books, :distributor/, change) # Ensure the line isn't gone completely
assert_no_match(/remove_reference :books, :distributor,.*\sforeign_key: true/, change)
end
end
Expand Down Expand Up @@ -237,7 +237,7 @@ def test_add_migration_with_references_adds_foreign_keys
assert_migration "db/migrate/#{migration}.rb" do |content|
assert_method :change, content do |change|
assert_match(/add_reference :books, :author,.*\sforeign_key: true/, change)
assert_match(/add_reference :books, :distributor/, change) # sanity check
assert_match(/add_reference :books, :distributor/, change) # Ensure the line isn't gone completely
assert_no_match(/add_reference :books, :distributor,.*\sforeign_key: true/, change)
end
end
Expand Down

0 comments on commit 2635106

Please sign in to comment.