4 # Class method to load the scenario. Used internally by the Scenarios
7 new.load_scenarios(used_scenarios + [self])
10 # Class method for your own scenario to define helper methods that will
11 # be included into the scenario and all specs that include the scenario
13 mod = (const_get(:Helpers) rescue const_set(:Helpers, Module.new))
14 mod.module_eval(&block) if block_given?
18 # Class method for your own scenario to define the scenarios that it
19 # depends on. If your scenario depends on other scenarios those
20 # scenarios will be loaded before the load method on your scenario is
23 names = scenarios.map(&:to_scenario).reject { |n| used_scenarios.include?(n) }
24 used_scenarios.concat(names)
27 # Class method that returns the scenarios used by your scenario.
28 def used_scenarios # :nodoc:
29 @used_scenarios ||= []
30 @used_scenarios = (@used_scenarios.collect(&:used_scenarios) + @used_scenarios).flatten.uniq
33 # Returns the scenario class.
42 attr_reader :table_config
44 # Initialize a scenario with a Configuration. Used internally by the
46 def initialize(config = Configuration.new)
47 @table_config = config
48 table_config.update_scenario_helpers self.class
49 self.extend table_config.table_readers
50 self.extend table_config.scenario_helpers
53 # This method should be implemented in your scenarios. You may also have
54 # scenarios that simply use other scenarios, so it is not required that
59 # Unload a scenario, sort of. This really only deletes the records, all of
60 # them, of every table this scenario modified. The goal is to maintain a
61 # clean database for successive runs. Used internally by the Scenarios
65 record_metas.each_value { |meta| blast_table(meta.table_name) }