Sha256: 18f1140ae1a338c248b1cf9733a62bc827e9016329213fb47aa491939161d478

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

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

require 'facet/string/underscore'
require 'facet/string/demodulize'
require 'facet/string/pluralize'

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

1 entries across 1 versions & 1 rubygems

Version Path
og-0.22.0 lib/og/test/testcase.rb