Class: ActiveSupport::TestCase

Inherits:
Object
  • Object
show all
Includes:
Datum
Defined in:
lib/support/test.rb

Overview

Note:

Supports most extending test types (functional, integration, etc)

Adds the process_scenario method to ActiveSupport::TestCase and includes the Datum module

Examples:

Making a Scenario

# test/datum/scenarios/simpsons_scenario.rb
# any code included in this file gets loaded when calling process_scenario
@homer = Person.create(first_name: "Homer", last_name: "Simpson")
@marge = Person.create(__clone(@homer, {first_name: "Marge"}))

Instance Attribute Summary

Attributes included from Datum

#container, #datum_id, #test_method_name

Instance Method Summary collapse

Instance Method Details

#process_scenario(scenario_name) ⇒ void

This method returns an undefined value.

Imports a scenario file into the execution context of the current test

Examples:

Using process_scenario

test "should verify basic scenario" do
  process_scenario :simpsons_scenario
  assert_not_nil @homer, "process_scenario did not define @homer"
  assert_not_nil @marge, "process_scenario did not define @marge"
end

Parameters:

  • scenario_name (Symbol, String)

    The name of a scenario file



23
24
25
26
27
28
29
# File 'lib/support/test.rb', line 23

class ActiveSupport::TestCase
  include Datum

  def process_scenario scenario_name
    __import(scenario_name)
  end
end