Class: Test::Unit::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/og/test/testcase.rb

Instance Method Summary collapse

Instance Method Details

#fixture(*classes) ⇒ Object

Include fixtures in this test case. – gmosx: this method should probably be moved to glue. ++



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/og/test/testcase.rb', line 20

def fixture(*classes)

  for klass in classes
    f = Glue::Fixture.new(klass)
    instance_variable_set "@#{klass.to_s.demodulize.underscore.pluralize}", f
    Glue::Fixtures[klass] = f
    
    # create variables for the fixture objects.
    
    for name, obj in f
      instance_variable_set "@#{name}", obj
    end      
  end

end

#og_fixture(*classes) ⇒ Object

Include fixtures in this test case, and serialize them in the active Og store.



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/og/test/testcase.rb', line 39

def og_fixture(*classes)
  fixture(*classes)

  for klass in classes
    f = Glue::Fixtures[klass]

    for obj in f.objects
      obj.save
    end
  end    
end