Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Alias refute methods to assert_not and perfer assert_not on tests

  • Loading branch information...
commit 5294ad82c6096edba06f4111325d6b0e6845d9f0 1 parent 6c0013f
@rafaelfranca rafaelfranca authored
Showing with 76 additions and 67 deletions.
  1. +1 −1  actionpack/lib/action_dispatch/testing/assertions/dom.rb
  2. +1 −1  actionpack/test/controller/live_stream_test.rb
  3. +1 −1  actionpack/test/dispatch/live_response_test.rb
  4. +1 −1  actionpack/test/dispatch/request/session_test.rb
  5. +1 −1  actionpack/test/dispatch/session/abstract_store_test.rb
  6. +1 −1  actionpack/test/dispatch/ssl_test.rb
  7. +2 −2 actionpack/test/journey/gtg/transition_table_test.rb
  8. +5 −5 actionpack/test/journey/nfa/simulator_test.rb
  9. +1 −1  actionpack/test/journey/nodes/symbol_test.rb
  10. +5 −5 actionpack/test/journey/path/pattern_test.rb
  11. +1 −1  actionpack/test/journey/route_test.rb
  12. +1 −1  actionpack/test/journey/router_test.rb
  13. +2 −2 actionpack/test/journey/routes_test.rb
  14. +1 −1  activerecord/test/cases/base_test.rb
  15. +5 −5 activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
  16. +7 −7 activerecord/test/cases/migration/change_schema_test.rb
  17. +4 −4 activerecord/test/cases/migration/column_attributes_test.rb
  18. +3 −3 activerecord/test/cases/migration/index_test.rb
  19. +4 −4 activerecord/test/cases/migration/references_index_test.rb
  20. +8 −8 activerecord/test/cases/migration/references_statements_test.rb
  21. +2 −2 activerecord/test/cases/migration_test.rb
  22. +4 −4 activerecord/test/cases/migrator_test.rb
  23. +2 −2 activerecord/test/cases/transactions_test.rb
  24. +10 −1 activesupport/lib/active_support/test_case.rb
  25. +2 −2 activesupport/test/core_ext/thread_test.rb
  26. +1 −1  activesupport/test/string_inquirer_test.rb
View
2  actionpack/lib/action_dispatch/testing/assertions/dom.rb
@@ -20,7 +20,7 @@ def assert_dom_equal(expected, actual, message = "")
def assert_dom_not_equal(expected, actual, message = "")
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
- refute_equal expected_dom, actual_dom
+ assert_not_equal expected_dom, actual_dom
end
end
end
View
2  actionpack/test/controller/live_stream_test.rb
@@ -40,7 +40,7 @@ def blocking_stream
def thread_locals
tc.assert_equal 'aaron', Thread.current[:setting]
- tc.refute_equal Thread.current.object_id, Thread.current[:originating_thread]
+ tc.assert_not_equal Thread.current.object_id, Thread.current[:originating_thread]
response.headers['Content-Type'] = 'text/event-stream'
%w{ hello world }.each do |word|
View
2  actionpack/test/dispatch/live_response_test.rb
@@ -11,7 +11,7 @@ def setup
def test_header_merge
header = @response.header.merge('Foo' => 'Bar')
assert_kind_of(ActionController::Live::Response::Header, header)
- refute_equal header, @response.header
+ assert_not_equal header, @response.header
end
def test_initialize_with_default_headers
View
2  actionpack/test/dispatch/request/session_test.rb
@@ -24,7 +24,7 @@ def test_create_merges_old
s['foo'] = 'bar'
s1 = Session.create(store, env, {})
- refute_equal s, s1
+ assert_not_equal s, s1
assert_equal 'bar', s1['foo']
end
View
2  actionpack/test/dispatch/session/abstract_store_test.rb
@@ -42,7 +42,7 @@ def test_new_session_object_is_merged_with_old
as.call(@env)
session1 = Request::Session.find @env
- refute_equal session, session1
+ assert_not_equal session, session1
assert_equal session.to_hash, session1.to_hash
end
View
2  actionpack/test/dispatch/ssl_test.rb
@@ -47,7 +47,7 @@ def test_hsts_header
def test_disable_hsts_header
self.app = ActionDispatch::SSL.new(default_app, :hsts => false)
get "https://example.org/"
- refute response.headers['Strict-Transport-Security']
+ assert_not response.headers['Strict-Transport-Security']
end
def test_hsts_expires
View
4 actionpack/test/journey/gtg/transition_table_test.rb
@@ -29,7 +29,7 @@ def test_to_svg
}
svg = table.to_svg
assert svg
- refute_match(/DOCTYPE/, svg)
+ assert_no_match(/DOCTYPE/, svg)
end
end
@@ -53,7 +53,7 @@ def test_simulate_optional
sim = simulator_for ['/foo(/bar)']
assert_match sim, '/foo'
assert_match sim, '/foo/bar'
- refute_match sim, '/foo/'
+ assert_no_match sim, '/foo/'
end
def test_match_data
View
10 actionpack/test/journey/nfa/simulator_test.rb
@@ -11,17 +11,17 @@ def test_simulate_simple
def test_simulate_simple_no_match
sim = simulator_for ['/foo']
- refute_match sim, 'foo'
+ assert_no_match sim, 'foo'
end
def test_simulate_simple_no_match_too_long
sim = simulator_for ['/foo']
- refute_match sim, '/foo/bar'
+ assert_no_match sim, '/foo/bar'
end
def test_simulate_simple_no_match_wrong_string
sim = simulator_for ['/foo']
- refute_match sim, '/bar'
+ assert_no_match sim, '/bar'
end
def test_simulate_regex
@@ -34,14 +34,14 @@ def test_simulate_or
sim = simulator_for ['/foo', '/bar']
assert_match sim, '/bar'
assert_match sim, '/foo'
- refute_match sim, '/baz'
+ assert_no_match sim, '/baz'
end
def test_simulate_optional
sim = simulator_for ['/foo(/bar)']
assert_match sim, '/foo'
assert_match sim, '/foo/bar'
- refute_match sim, '/foo/'
+ assert_no_match sim, '/foo/'
end
def test_matchdata_has_memos
View
2  actionpack/test/journey/nodes/symbol_test.rb
@@ -9,7 +9,7 @@ def test_default_regexp?
assert sym.default_regexp?
sym.regexp = nil
- refute sym.default_regexp?
+ assert_not sym.default_regexp?
end
end
end
View
10 actionpack/test/journey/path/pattern_test.rb
@@ -88,7 +88,7 @@ def test_to_regexp_with_extended_group
path = Pattern.new strexp
assert_match(path, '/page/tender')
assert_match(path, '/page/love')
- refute_match(path, '/page/loving')
+ assert_no_match(path, '/page/loving')
end
def test_optional_names
@@ -110,7 +110,7 @@ def test_to_regexp_match_non_optional
)
path = Pattern.new strexp
assert_match(path, '/123')
- refute_match(path, '/')
+ assert_no_match(path, '/')
end
def test_to_regexp_with_group
@@ -122,7 +122,7 @@ def test_to_regexp_with_group
path = Pattern.new strexp
assert_match(path, '/page/tender')
assert_match(path, '/page/love')
- refute_match(path, '/page/loving')
+ assert_no_match(path, '/page/loving')
end
def test_ast_sets_regular_expressions
@@ -189,7 +189,7 @@ def test_insensitive_regexp_with_group
path = Pattern.new strexp
assert_match(path, '/page/TENDER/aaron')
assert_match(path, '/page/loVE/aaron')
- refute_match(path, '/page/loVE/AAron')
+ assert_no_match(path, '/page/loVE/AAron')
end
def test_to_regexp_with_strexp
@@ -210,7 +210,7 @@ def test_failed_match
path = Pattern.new '/:controller(/:action(/:id(.:format)))'
uri = 'content'
- refute path =~ uri
+ assert_not path =~ uri
end
def test_match_controller
View
2  actionpack/test/journey/route_test.rb
@@ -92,7 +92,7 @@ def test_score
routes = [specific, generic]
- refute_equal specific.score(knowledge), generic.score(knowledge)
+ assert_not_equal specific.score(knowledge), generic.score(knowledge)
found = routes.sort_by { |r| r.score(knowledge) }.last
View
2  actionpack/test/journey/router_test.rb
@@ -277,7 +277,7 @@ def test_path_not_found
@router.recognize(env) do |*whatever|
yielded = true
end
- refute yielded
+ assert_not yielded
end
def test_required_part_in_recall
View
4 actionpack/test/journey/routes_test.rb
@@ -23,7 +23,7 @@ def test_ast
routes.add_route nil, path, {}, {}, {}
ast = routes.ast
routes.add_route nil, path, {}, {}, {}
- refute_equal ast, routes.ast
+ assert_not_equal ast, routes.ast
end
def test_simulator_changes
@@ -33,7 +33,7 @@ def test_simulator_changes
routes.add_route nil, path, {}, {}, {}
sim = routes.simulator
routes.add_route nil, path, {}, {}, {}
- refute_equal sim, routes.simulator
+ assert_not_equal sim, routes.simulator
end
def test_first_name_wins
View
2  activerecord/test/cases/base_test.rb
@@ -1484,7 +1484,7 @@ def test_table_name_with_2_abstract_subclasses
def test_column_types_typecast
topic = Topic.first
- refute_equal 't.lo', topic.author_name
+ assert_not_equal 't.lo', topic.author_name
attrs = topic.attributes.dup
attrs.delete 'id'
View
10 activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
@@ -10,18 +10,18 @@ def setup
end
def test_in_use?
- refute adapter.in_use?, 'adapter is not in use'
+ assert_not adapter.in_use?, 'adapter is not in use'
assert adapter.lease, 'lease adapter'
assert adapter.in_use?, 'adapter is in use'
end
def test_lease_twice
assert adapter.lease, 'should lease adapter'
- refute adapter.lease, 'should not lease adapter'
+ assert_not adapter.lease, 'should not lease adapter'
end
def test_last_use
- refute adapter.last_use
+ assert_not adapter.last_use
adapter.lease
assert adapter.last_use
end
@@ -30,7 +30,7 @@ def test_expire_mutates_in_use
assert adapter.lease, 'lease adapter'
assert adapter.in_use?, 'adapter is in use'
adapter.expire
- refute adapter.in_use?, 'adapter is in use'
+ assert_not adapter.in_use?, 'adapter is in use'
end
def test_close
@@ -44,7 +44,7 @@ def test_close
# Close should put the adapter back in the pool
adapter.close
- refute adapter.in_use?
+ assert_not adapter.in_use?
assert_equal adapter, pool.connection
end
View
14 activerecord/test/cases/migration/change_schema_test.rb
@@ -293,7 +293,7 @@ def test_column_exists
end
assert connection.column_exists?(:testings, :foo)
- refute connection.column_exists?(:testings, :bar)
+ assert_not connection.column_exists?(:testings, :bar)
end
def test_column_exists_with_type
@@ -303,10 +303,10 @@ def test_column_exists_with_type
end
assert connection.column_exists?(:testings, :foo, :string)
- refute connection.column_exists?(:testings, :foo, :integer)
+ assert_not connection.column_exists?(:testings, :foo, :integer)
assert connection.column_exists?(:testings, :bar, :decimal)
- refute connection.column_exists?(:testings, :bar, :integer)
+ assert_not connection.column_exists?(:testings, :bar, :integer)
end
def test_column_exists_with_definition
@@ -318,13 +318,13 @@ def test_column_exists_with_definition
end
assert connection.column_exists?(:testings, :foo, :string, limit: 100)
- refute connection.column_exists?(:testings, :foo, :string, limit: nil)
+ assert_not connection.column_exists?(:testings, :foo, :string, limit: nil)
assert connection.column_exists?(:testings, :bar, :decimal, precision: 8, scale: 2)
- refute connection.column_exists?(:testings, :bar, :decimal, precision: nil, scale: nil)
+ assert_not connection.column_exists?(:testings, :bar, :decimal, precision: nil, scale: nil)
assert connection.column_exists?(:testings, :taggable_id, :integer, null: false)
- refute connection.column_exists?(:testings, :taggable_id, :integer, null: true)
+ assert_not connection.column_exists?(:testings, :taggable_id, :integer, null: true)
assert connection.column_exists?(:testings, :taggable_type, :string, default: 'Photo')
- refute connection.column_exists?(:testings, :taggable_type, :string, default: nil)
+ assert_not connection.column_exists?(:testings, :taggable_type, :string, default: nil)
end
def test_column_exists_on_table_with_no_options_parameter_supplied
View
8 activerecord/test/cases/migration/column_attributes_test.rb
@@ -16,7 +16,7 @@ def test_add_column_newline_default
end
def test_add_remove_single_field_using_string_arguments
- refute TestModel.column_methods_hash.key?(:last_name)
+ assert_not TestModel.column_methods_hash.key?(:last_name)
add_column 'test_models', 'last_name', :string
@@ -27,11 +27,11 @@ def test_add_remove_single_field_using_string_arguments
remove_column 'test_models', 'last_name'
TestModel.reset_column_information
- refute TestModel.column_methods_hash.key?(:last_name)
+ assert_not TestModel.column_methods_hash.key?(:last_name)
end
def test_add_remove_single_field_using_symbol_arguments
- refute TestModel.column_methods_hash.key?(:last_name)
+ assert_not TestModel.column_methods_hash.key?(:last_name)
add_column :test_models, :last_name, :string
@@ -41,7 +41,7 @@ def test_add_remove_single_field_using_symbol_arguments
remove_column :test_models, :last_name
TestModel.reset_column_information
- refute TestModel.column_methods_hash.key?(:last_name)
+ assert_not TestModel.column_methods_hash.key?(:last_name)
end
def test_unabstracted_database_dependent_types
View
6 activerecord/test/cases/migration/index_test.rb
@@ -35,7 +35,7 @@ def test_rename_index
connection.rename_index(table_name, 'old_idx', 'new_idx')
# if the adapter doesn't support the indexes call, pick defaults that let the test pass
- refute connection.index_name_exists?(table_name, 'old_idx', false)
+ assert_not connection.index_name_exists?(table_name, 'old_idx', false)
assert connection.index_name_exists?(table_name, 'new_idx', true)
end
@@ -63,7 +63,7 @@ def test_add_index_name_length_limit
connection.add_index(table_name, "foo", :name => too_long_index_name)
}
- refute connection.index_name_exists?(table_name, too_long_index_name, false)
+ assert_not connection.index_name_exists?(table_name, too_long_index_name, false)
connection.add_index(table_name, "foo", :name => good_index_name)
assert connection.index_name_exists?(table_name, good_index_name, false)
@@ -75,7 +75,7 @@ def test_index_symbol_names
assert connection.index_exists?(table_name, :foo, :name => :symbol_index_name)
connection.remove_index table_name, :name => :symbol_index_name
- refute connection.index_exists?(table_name, :foo, :name => :symbol_index_name)
+ assert_not connection.index_exists?(table_name, :foo, :name => :symbol_index_name)
end
def test_index_exists
View
8 activerecord/test/cases/migration/references_index_test.rb
@@ -29,7 +29,7 @@ def test_does_not_create_index
t.references :foo
end
- refute connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
+ assert_not connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
end
def test_does_not_create_index_explicit
@@ -37,7 +37,7 @@ def test_does_not_create_index_explicit
t.references :foo, :index => false
end
- refute connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
+ assert_not connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
end
def test_creates_index_with_options
@@ -75,7 +75,7 @@ def test_does_not_create_index_for_existing_table
t.references :foo
end
- refute connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
+ assert_not connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
end
def test_does_not_create_index_for_existing_table_explicit
@@ -84,7 +84,7 @@ def test_does_not_create_index_for_existing_table_explicit
t.references :foo, :index => false
end
- refute connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
+ assert_not connection.index_exists?(table_name, :foo_id, :name => :index_testings_on_foo_id)
end
def test_creates_polymorphic_index_for_existing_table
View
16 activerecord/test/cases/migration/references_statements_test.rb
@@ -22,7 +22,7 @@ def test_creates_reference_id_column
def test_does_not_create_reference_type_column
add_reference table_name, :taggable
- refute column_exists?(table_name, :taggable_type, :string)
+ assert_not column_exists?(table_name, :taggable_type, :string)
end
def test_creates_reference_type_column
@@ -37,7 +37,7 @@ def test_creates_reference_id_index
def test_does_not_create_reference_id_index
add_reference table_name, :user
- refute index_exists?(table_name, :user_id)
+ assert_not index_exists?(table_name, :user_id)
end
def test_creates_polymorphic_index
@@ -57,19 +57,19 @@ def test_creates_named_index
def test_deletes_reference_id_column
remove_reference table_name, :supplier
- refute column_exists?(table_name, :supplier_id, :integer)
+ assert_not column_exists?(table_name, :supplier_id, :integer)
end
def test_deletes_reference_id_index
remove_reference table_name, :supplier
- refute index_exists?(table_name, :supplier_id)
+ assert_not index_exists?(table_name, :supplier_id)
end
def test_does_not_delete_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier
- refute column_exists?(table_name, :supplier_id, :integer)
+ assert_not column_exists?(table_name, :supplier_id, :integer)
assert column_exists?(table_name, :supplier_type, :string)
end
end
@@ -77,14 +77,14 @@ def test_does_not_delete_reference_type_column
def test_deletes_reference_type_column
with_polymorphic_column do
remove_reference table_name, :supplier, polymorphic: true
- refute column_exists?(table_name, :supplier_type, :string)
+ assert_not column_exists?(table_name, :supplier_type, :string)
end
end
def test_deletes_polymorphic_index
with_polymorphic_column do
remove_reference table_name, :supplier, polymorphic: true
- refute index_exists?(table_name, [:supplier_id, :supplier_type])
+ assert_not index_exists?(table_name, [:supplier_id, :supplier_type])
end
end
@@ -95,7 +95,7 @@ def test_add_belongs_to_alias
def test_remove_belongs_to_alias
remove_belongs_to table_name, :supplier
- refute column_exists?(table_name, :supplier_id, :integer)
+ assert_not column_exists?(table_name, :supplier_id, :integer)
end
private
View
4 activerecord/test/cases/migration_test.rb
@@ -232,7 +232,7 @@ def test_migrator_one_up_with_exception_and_rollback
skip "not supported on #{ActiveRecord::Base.connection.class}"
end
- refute Person.column_methods_hash.include?(:last_name)
+ assert_not Person.column_methods_hash.include?(:last_name)
migration = Struct.new(:name, :version) {
def migrate(x); raise 'Something broke'; end
@@ -245,7 +245,7 @@ def migrate(x); raise 'Something broke'; end
assert_equal "An error has occurred, this and all later migrations canceled:\n\nSomething broke", e.message
Person.reset_column_information
- refute Person.column_methods_hash.include?(:last_name)
+ assert_not Person.column_methods_hash.include?(:last_name)
end
def test_schema_migrations_table_name
View
8 activerecord/test/cases/migrator_test.rb
@@ -121,11 +121,11 @@ def test_migrator_interleaved_migrations
ActiveRecord::Migrator.new(:up, pass_one).migrate
assert pass_one.first.went_up
- refute pass_one.first.went_down
+ assert_not pass_one.first.went_down
pass_two = [Sensor.new('One', 1), Sensor.new('Three', 3)]
ActiveRecord::Migrator.new(:up, pass_two).migrate
- refute pass_two[0].went_up
+ assert_not pass_two[0].went_up
assert pass_two[1].went_up
assert pass_two.all? { |x| !x.went_down }
@@ -135,7 +135,7 @@ def test_migrator_interleaved_migrations
ActiveRecord::Migrator.new(:down, pass_three).migrate
assert pass_three[0].went_down
- refute pass_three[1].went_down
+ assert_not pass_three[1].went_down
assert pass_three[2].went_down
end
@@ -307,7 +307,7 @@ def test_migrator_db_has_no_schema_migrations_table
_, migrator = migrator_class(3)
ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations")
- refute ActiveRecord::Base.connection.table_exists?('schema_migrations')
+ assert_not ActiveRecord::Base.connection.table_exists?('schema_migrations')
migrator.migrate("valid", 1)
assert ActiveRecord::Base.connection.table_exists?('schema_migrations')
end
View
4 activerecord/test/cases/transactions_test.rb
@@ -15,7 +15,7 @@ def setup
end
def test_raise_after_destroy
- refute @first.frozen?
+ assert_not @first.frozen?
assert_raises(RuntimeError) {
Topic.transaction do
@@ -26,7 +26,7 @@ def test_raise_after_destroy
}
assert @first.reload
- refute @first.frozen?
+ assert_not @first.frozen?
end
def test_successful
View
11 activesupport/lib/active_support/test_case.rb
@@ -41,9 +41,18 @@ def self.test_order # :nodoc:
# test/unit backwards compatibility methods
alias :assert_raise :assert_raises
- alias :assert_not_nil :refute_nil
+ alias :assert_not_empty :refute_empty
alias :assert_not_equal :refute_equal
+ alias :assert_not_in_delta :refute_in_delta
+ alias :assert_not_in_epsilon :refute_in_epsilon
+ alias :assert_not_includes :refute_includes
+ alias :assert_not_instance_of :refute_instance_of
+ alias :assert_not_kind_of :refute_kind_of
alias :assert_no_match :refute_match
+ alias :assert_not_nil :refute_nil
+ alias :assert_not_operator :refute_operator
+ alias :assert_not_predicate :refute_predicate
+ alias :assert_not_respond_to :refute_respond_to
alias :assert_not_same :refute_same
# Fails if the block raises an exception.
View
4 activesupport/test/core_ext/thread_test.rb
@@ -39,14 +39,14 @@ def test_thread_variables
end
def test_thread_variable?
- refute Thread.new { Thread.current.thread_variable?("foo") }.join.value
+ assert_not Thread.new { Thread.current.thread_variable?("foo") }.join.value
t = Thread.new {
Thread.current.thread_variable_set("foo", "bar")
}.join
assert t.thread_variable?("foo")
assert t.thread_variable?(:foo)
- refute t.thread_variable?(:bar)
+ assert_not t.thread_variable?(:bar)
end
def test_thread_variable_strings_and_symbols_are_the_same_key
View
2  activesupport/test/string_inquirer_test.rb
@@ -10,7 +10,7 @@ def test_match
end
def test_miss
- refute @string_inquirer.development?
+ assert_not @string_inquirer.development?
end
def test_missing_question_mark
Please sign in to comment.
Something went wrong with that request. Please try again.