2 # Provides scenario loading and convenience methods around the Configuration
3 # that must be made available through a method _table_config_.
4 module Loading # :nodoc:
5 def load_scenarios(scenario_classes)
6 install_active_record_tracking_hook
7 scenario_classes.each do |scenario_class|
8 scenario = scenario_class.new(table_config)
10 table_config.loaded_scenarios << scenario
11 end if scenario_classes
15 table_config.loaded_scenarios
19 table_config && table_config.scenarios_loaded?
22 # The sum of all the loaded scenario's helper methods. These can be mixed
23 # into anything you like to gain access to them.
25 table_config.scenario_helpers
28 # The sum of all the available table reading methods. These will only
29 # include readers for which data has been placed into the table. These can
30 # be mixed into anything you like to gain access to them.
32 table_config.table_readers
35 # # This understand nesting descriptions one deep
37 # on_my_class = self.class.instance_variable_get("@table_config")
38 # return on_my_class if on_my_class
40 # if self.class.superclass
41 # on_super_class = self.class.superclass.instance_variable_get("@table_config")
42 # return on_super_class if on_super_class
47 def install_active_record_tracking_hook
48 ActiveRecord::Base.table_config = table_config