Class: ActiveSupport::TestCase
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| Subclasses: | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
          DescendantsTracker,
          Testing::Declarative,
          Minitest::Test
         | |
| Instance Chain: 
          self,
          ::ActiveRecord::TestFixtures,
          Testing::TimeHelpers,
          Testing::Assertions,
          Callbacks,
          Testing::SetupAndTeardown,
          Minitest::Test
         | |
| Inherits: | Minitest::Test 
 | 
| Defined in: | activesupport/lib/active_support/test_case.rb, railties/lib/rails/test_help.rb | 
Constant Summary
- 
    Assertion =
    
 # File 'activesupport/lib/active_support/test_case.rb', line 16Minitest::Assertion 
Callbacks - self
::ActiveRecord::TestFixtures - Attributes & Methods
- .config rw
- #config rw
- .config? ⇒ Boolean rw
- #config? ⇒ Boolean rw
- .fixture_class_names rw
- #fixture_class_names rw
- .fixture_class_names? ⇒ Boolean rw
- #fixture_class_names? ⇒ Boolean rw
- .fixture_path rw
- #fixture_path rw
- .fixture_path? ⇒ Boolean rw
- #fixture_path? ⇒ Boolean rw
- .fixture_table_names rw
- #fixture_table_names rw
- .fixture_table_names? ⇒ Boolean rw
- #fixture_table_names? ⇒ Boolean rw
- .pre_loaded_fixtures rw
- #pre_loaded_fixtures rw
- .pre_loaded_fixtures? ⇒ Boolean rw
- #pre_loaded_fixtures? ⇒ Boolean rw
- .use_instantiated_fixtures rw
- #use_instantiated_fixtures rw
- .use_instantiated_fixtures? ⇒ Boolean rw
- #use_instantiated_fixtures? ⇒ Boolean rw
- .use_transactional_fixtures rw
- #use_transactional_fixtures rw
- .use_transactional_fixtures? ⇒ Boolean rw
- #use_transactional_fixtures? ⇒ Boolean rw
Class Attribute Summary
- 
    
      .test_order  
    
    rw
    Returns the order in which test cases are run. 
- 
    
      .test_order=(new_order)  
    
    rw
    Sets the order in which test cases are run. 
Class Method Summary
DescendantsTracker - self
| clear, descendants, direct_descendants, | |
| store_inherited | This is the only method that is not thread safe, but is only ever called during the eager loading phase. | 
Testing::Declarative - Extended
Instance Attribute Summary
::ActiveRecord::TestFixtures - Included
Instance Method Summary
- #assert_no_match
- #assert_not_empty
- #assert_not_equal
- #assert_not_in_delta
- #assert_not_in_epsilon
- #assert_not_includes
- #assert_not_instance_of
- #assert_not_kind_of
- #assert_not_nil
- #assert_not_operator
- #assert_not_predicate
- #assert_not_respond_to
- #assert_not_same
- 
    
      #assert_nothing_raised(*args)  
    
    Fails if the block raises an exception. 
- 
    
      #assert_raise  
    
    test/unit backwards compatibility methods. 
- #method_name
::ActiveRecord::TestFixtures - Included
Testing::TimeHelpers - Included
| #travel | Changes current time to the time in the future or in the past by a given time difference by stubbing  | 
| #travel_back | Returns the current time back to its original state, by removing the stubs added by  | 
| #travel_to | Changes current time to the given time by stubbing  | 
Testing::Assertions - Included
| #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_difference | Assertion that the numeric result of evaluating an expression is not changed before and after invoking the passed in block. | 
| #assert_not | Assert that an expression is not truthy. | 
Callbacks - self
| #run_callbacks | Runs the callbacks for the given event. | 
Class Attribute Details
.config (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 842
class_attribute :config
    .config?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 842
class_attribute :config
.fixture_class_names (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 838
class_attribute :fixture_class_names
    .fixture_class_names?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 838
class_attribute :fixture_class_names
.fixture_path (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 836
class_attribute :fixture_path, :instance_writer => false
    .fixture_path?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 836
class_attribute :fixture_path, :instance_writer => false
.fixture_table_names (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 837
class_attribute :fixture_table_names
    .fixture_table_names?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 837
class_attribute :fixture_table_names
.pre_loaded_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 841
class_attribute :pre_loaded_fixtures
    .pre_loaded_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 841
class_attribute :pre_loaded_fixtures
.test_order (rw)
Returns the order in which test cases are run.
ActiveSupport::TestCase.test_order # => :sortedPossible values are :random, :parallel, :alpha, :sorted. Defaults to :sorted.
# File 'activesupport/lib/active_support/test_case.rb', line 38
def test_order test_order = ActiveSupport.test_order if test_order.nil? ActiveSupport::Deprecation.warn "You did not specify a value for the " \ "configuration option `active_support.test_order`. In Rails 5, " \ "the default value of this option will change from `:sorted` to " \ "`:random`.\n" \ "To disable this warning and keep the current behavior, you can add " \ "the following line to your `config/environments/test.rb`:\n" \ "\n" \ " Rails.application.configure do\n" \ " config.active_support.test_order = :sorted\n" \ " end\n" \ "\n" \ "Alternatively, you can opt into the future behavior by setting this " \ "option to `:random`." test_order = :sorted self.test_order = test_order end test_order end
.test_order=(new_order) (rw)
Sets the order in which test cases are run.
ActiveSupport::TestCase.test_order = :random # => :randomValid 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)
# File 'activesupport/lib/active_support/test_case.rb', line 28
def test_order=(new_order) ActiveSupport.test_order = new_order end
.use_instantiated_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 840
class_attribute :use_instantiated_fixtures # true, false, or :no_instances
    .use_instantiated_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 840
class_attribute :use_instantiated_fixtures # true, false, or :no_instances
.use_transactional_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 839
class_attribute :use_transactional_fixtures
    .use_transactional_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 839
class_attribute :use_transactional_fixtures
Class Method Details
.my_tests_are_order_dependent!
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 63
alias :my_tests_are_order_dependent! :i_suck_and_my_tests_are_order_dependent!
Instance Attribute Details
#config (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 842
class_attribute :config
    #config?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 842
class_attribute :config
#fixture_class_names (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 838
class_attribute :fixture_class_names
    #fixture_class_names?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 838
class_attribute :fixture_class_names
#fixture_path (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 836
class_attribute :fixture_path, :instance_writer => false
    #fixture_path?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 836
class_attribute :fixture_path, :instance_writer => false
#fixture_table_names (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 837
class_attribute :fixture_table_names
    #fixture_table_names?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 837
class_attribute :fixture_table_names
#pre_loaded_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 841
class_attribute :pre_loaded_fixtures
    #pre_loaded_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 841
class_attribute :pre_loaded_fixtures
#use_instantiated_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 840
class_attribute :use_instantiated_fixtures # true, false, or :no_instances
    #use_instantiated_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 840
class_attribute :use_instantiated_fixtures # true, false, or :no_instances
#use_transactional_fixtures (rw)
[ GitHub ]# File 'activerecord/lib/active_record/fixtures.rb', line 839
class_attribute :use_transactional_fixtures
    #use_transactional_fixtures?  ⇒ Boolean  (rw)
  
  [ GitHub ]
# File 'activerecord/lib/active_record/fixtures.rb', line 839
class_attribute :use_transactional_fixtures
Instance Method Details
#assert_no_match
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 84
alias :assert_no_match :refute_match
#assert_not_empty
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 77
alias :assert_not_empty :refute_empty
#assert_not_equal
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 78
alias :assert_not_equal :refute_equal
#assert_not_in_delta
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 79
alias :assert_not_in_delta :refute_in_delta
#assert_not_in_epsilon
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 80
alias :assert_not_in_epsilon :refute_in_epsilon
#assert_not_includes
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 81
alias :assert_not_includes :refute_includes
#assert_not_instance_of
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 82
alias :assert_not_instance_of :refute_instance_of
#assert_not_kind_of
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 83
alias :assert_not_kind_of :refute_kind_of
#assert_not_nil
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 85
alias :assert_not_nil :refute_nil
#assert_not_operator
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 86
alias :assert_not_operator :refute_operator
#assert_not_predicate
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 87
alias :assert_not_predicate :refute_predicate
#assert_not_respond_to
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 88
alias :assert_not_respond_to :refute_respond_to
#assert_not_same
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 89
alias :assert_not_same :refute_same
#assert_nothing_raised(*args)
Fails if the block raises an exception.
assert_nothing_raised do
  #...
end# File 'activesupport/lib/active_support/test_case.rb', line 96
def assert_nothing_raised(*args) yield end
#assert_raise
test/unit backwards compatibility methods
# File 'activesupport/lib/active_support/test_case.rb', line 76
alias :assert_raise :assert_raises
#method_name
[ GitHub ]# File 'activesupport/lib/active_support/test_case.rb', line 66
alias_method :method_name, :name