123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::TestCase

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Testing::Declarative, Minitest::Test
Instance Chain:
Inherits: Minitest::Test
  • ::Object
Defined in: activesupport/lib/active_support/test_case.rb,
railties/lib/rails/test_help.rb

Constant Summary

::ActiveRecord::TestFixtures - Attributes & Methods

Testing::FileFixtures - Attributes & Methods

Class Attribute Summary

Class Method Summary

Testing::Declarative - Extended

test

Helper to define a test method using a ::String.

Instance Attribute Summary

Instance Method Summary

::ActiveRecord::TestFixtures - Included

Testing::FileFixtures - Included

#file_fixture

Returns a ::Pathname to the fixture file named fixture_name.

Testing::TimeHelpers - Included

#after_teardown,
#freeze_time

Calls travel_to with Time.now.

#travel

Changes current time to the time in the future or in the past by a given time difference by stubbing Time.now, Date.today, and DateTime.now.

#travel_back

Returns the current time back to its original state, by removing the stubs added by travel and travel_to.

#travel_to

Changes current time to the given time by stubbing Time.now, Date.today, and DateTime.now to return the time or date passed into this method.

Testing::Assertions - Included

#assert_changes

Assertion that the result of evaluating an expression is changed before and after invoking the passed in block.

#assert_difference

Test numeric difference between the return value of an expression as a result of what is evaluated in the yielded block.

#assert_no_changes

Assertion that the result of evaluating an expression is not changed before and after invoking the passed in block.

#assert_no_difference

Assertion that the numeric result of evaluating an expression is not changed before and after invoking the passed in block.

#assert_not

Asserts that an expression is not truthy.

#assert_nothing_raised

Assertion that the block should not raise an exception.

Class Attribute Details

.config (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 876

class_attribute :config, default: ActiveRecord::Base

.config?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 876

class_attribute :config, default: ActiveRecord::Base

.file_fixture_path (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/file_fixtures.rb', line 18

class_attribute :file_fixture_path, instance_writer: false

.file_fixture_path?Boolean (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/file_fixtures.rb', line 18

class_attribute :file_fixture_path, instance_writer: false

.fixture_class_names (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 872

class_attribute :fixture_class_names, default: {}

.fixture_class_names?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 872

class_attribute :fixture_class_names, default: {}

.fixture_path (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 870

class_attribute :fixture_path, instance_writer: false

.fixture_path?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 870

class_attribute :fixture_path, instance_writer: false

.fixture_table_names (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 871

class_attribute :fixture_table_names, default: []

.fixture_table_names?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 871

class_attribute :fixture_table_names, default: []

.pre_loaded_fixtures (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 875

class_attribute :pre_loaded_fixtures, default: false

.pre_loaded_fixtures?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 875

class_attribute :pre_loaded_fixtures, default: false

.test_order (rw)

Returns the order in which test cases are run.

ActiveSupport::TestCase.test_order # => :random

Possible values are :random, :parallel, :alpha, :sorted. Defaults to :random.

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 39

def test_order
  ActiveSupport.test_order ||= :random
end

.test_order=(new_order) (rw)

Sets the order in which test cases are run.

ActiveSupport::TestCase.test_order = :random # => :random

Valid values are:

  • :random (to run tests in random order)

  • :parallel (to run tests in parallel)

  • :sorted (to run tests alphabetically by method name)

  • :alpha (equivalent to :sorted)

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 29

def test_order=(new_order)
  ActiveSupport.test_order = new_order
end

.use_instantiated_fixtures (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 874

class_attribute :use_instantiated_fixtures, default: false # true, false, or :no_instances

.use_instantiated_fixtures?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 874

class_attribute :use_instantiated_fixtures, default: false # true, false, or :no_instances

.use_transactional_tests (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 873

class_attribute :use_transactional_tests, default: true

.use_transactional_tests?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 873

class_attribute :use_transactional_tests, default: true

Instance Attribute Details

#config (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 876

class_attribute :config, default: ActiveRecord::Base

#config?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 876

class_attribute :config, default: ActiveRecord::Base

#file_fixture_path (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/file_fixtures.rb', line 18

class_attribute :file_fixture_path, instance_writer: false

#file_fixture_path?Boolean (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/testing/file_fixtures.rb', line 18

class_attribute :file_fixture_path, instance_writer: false

#fixture_class_names (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 872

class_attribute :fixture_class_names, default: {}

#fixture_class_names?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 872

class_attribute :fixture_class_names, default: {}

#fixture_path (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 870

class_attribute :fixture_path, instance_writer: false

#fixture_path?Boolean (readonly)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 870

class_attribute :fixture_path, instance_writer: false

#fixture_table_names (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 871

class_attribute :fixture_table_names, default: []

#fixture_table_names?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 871

class_attribute :fixture_table_names, default: []

#pre_loaded_fixtures (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 875

class_attribute :pre_loaded_fixtures, default: false

#pre_loaded_fixtures?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 875

class_attribute :pre_loaded_fixtures, default: false

#use_instantiated_fixtures (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 874

class_attribute :use_instantiated_fixtures, default: false # true, false, or :no_instances

#use_instantiated_fixtures?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 874

class_attribute :use_instantiated_fixtures, default: false # true, false, or :no_instances

#use_transactional_tests (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 873

class_attribute :use_transactional_tests, default: true

#use_transactional_tests?Boolean (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/fixtures.rb', line 873

class_attribute :use_transactional_tests, default: true

Instance Method Details

#assert_no_match

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 63

alias :assert_no_match :refute_match

#assert_not_empty

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 56

alias :assert_not_empty :refute_empty

#assert_not_equal

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 57

alias :assert_not_equal :refute_equal

#assert_not_in_delta

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 58

alias :assert_not_in_delta :refute_in_delta

#assert_not_in_epsilon

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 59

alias :assert_not_in_epsilon :refute_in_epsilon

#assert_not_includes

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 60

alias :assert_not_includes :refute_includes

#assert_not_instance_of

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 61

alias :assert_not_instance_of :refute_instance_of

#assert_not_kind_of

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 62

alias :assert_not_kind_of :refute_kind_of

#assert_not_nil

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 64

alias :assert_not_nil :refute_nil

#assert_not_operator

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 65

alias :assert_not_operator :refute_operator

#assert_not_predicate

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 66

alias :assert_not_predicate :refute_predicate

#assert_not_respond_to

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 67

alias :assert_not_respond_to :refute_respond_to

#assert_not_same

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 68

alias :assert_not_same :refute_same

#assert_raise

test/unit backwards compatibility methods

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 55

alias :assert_raise :assert_raises

#method_name

[ GitHub ]

  
# File 'activesupport/lib/active_support/test_case.rb', line 44

alias_method :method_name, :name