Module: ActiveRecord::TestFixtures
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::ActiveSupport::Concern
|
|
Defined in: | activerecord/lib/active_record/test_fixtures.rb |
Class Method Summary
::ActiveSupport::Concern
- Extended
class_methods | Define class methods from given block. |
included | Evaluate given block in context of base class, so that you can write class macros here. |
prepended | Evaluate given block in context of base class, so that you can write class macros here. |
Instance Method Summary
-
#fixture(fixture_set_name, *fixture_names)
Generic fixture accessor for fixture names that may conflict with other methods.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) (private)
[ GitHub ]# File 'activerecord/lib/active_record/test_fixtures.rb', line 301
def method_missing(method, ...) if fixture_sets.key?(method.name) active_record_fixture(method, ...) else super end end
DSL Calls
included
[ GitHub ]20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
# File 'activerecord/lib/active_record/test_fixtures.rb', line 20
included do ## # :singleton-method: fixture_paths # # Returns the ActiveRecord::FixtureSet collection ## # :singleton-method: fixture_paths= # # :call-seq: # fixture_paths=(fixture_paths) class_attribute :fixture_paths, instance_writer: false, default: [] class_attribute :fixture_table_names, default: [] class_attribute :fixture_class_names, default: {} class_attribute :use_transactional_tests, default: true class_attribute :use_instantiated_fixtures, default: false # true, false, or :no_instances class_attribute :pre_loaded_fixtures, default: false class_attribute :lock_threads, default: true class_attribute :fixture_sets, default: {} class_attribute :database_transactions_config, default: {} ActiveSupport.run_load_hooks(:active_record_fixtures, self) end
Instance Method Details
#fixture(fixture_set_name, *fixture_names)
Generic fixture accessor for fixture names that may conflict with other methods.
assert_equal "Ruby on Rails", web_sites(:rubyonrails).name
assert_equal "Ruby on Rails", fixture(:web_sites, :rubyonrails).name
# File 'activerecord/lib/active_record/test_fixtures.rb', line 118
def fixture(fixture_set_name, *fixture_names) active_record_fixture(fixture_set_name, *fixture_names) end