Sha256: c19a853c78b116f48e6de97a7f1f03c100d3d25f6d3c19718efc4b11140902af

Contents?: true

Size: 981 Bytes

Versions: 5

Compression:

Stored size: 981 Bytes

Contents

require 'test/unit'
require 'test/unit/assertions'

require 'mega/orm_support'

require 'glue'
require 'glue/fixture'
require 'og'
require 'og/test/assertions'

module Test::Unit
  
class TestCase

  # Include fixtures in this test case.
  #--
  # gmosx: this method should probably be moved to glue.
  #++
  
  def fixture(*classes)
  
    for klass in classes
      f = Fixture.new(klass)
      instance_variable_set "@#{klass.to_s.demodulize.underscore.pluralize}", f
      Fixtures[klass] = f
      
      # create variables for the fixture objects.
      
      for name, obj in f
        instance_variable_set "@#{name}", obj
      end      
    end

  end  
  
  # Include fixtures in this test case, and serialize them in 
  # the active Og store.
  
  def og_fixture(*classes)
    fixture(*classes)

    for klass in classes
      f = Fixtures[klass]

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

end

end

# * George Moschovitis <gm@navel.gr>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
og-0.23.0 lib/og/test/testcase.rb
og-0.24.0 lib/og/test/testcase.rb
og-0.25.0 lib/og/test/testcase.rb
og-0.26.0 lib/og/test/testcase.rb
og-0.27.0 lib/og/test/testcase.rb