Sha256: 60e94c7bd30ac6639fce39a0a534069d86fcfb9d75a3a38c75591472dbf81b89

Contents?: true

Size: 992 Bytes

Versions: 8

Compression:

Stored size: 992 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), 'lib')

require 'test/unit'
require 'glue/fixture'

class TestFixture < Test::Unit::TestCase # :nodoc: all
  include Glue

  class User
    attr_accessor :name
    attr_accessor :age
  end

  class Article
    attr_accessor :title
    attr_accessor :body
  end
        
  def test_all
    users = Fixture.new(User)
    
    assert_equal 3, users.size
    george = users['george']
    assert_equal 30, george.age
    assert_equal 'Renos', users['renos'].name

    articles = Fixture.new(Article)
    
    assert_equal 9, articles.size
    assert_equal 'This is cool', articles['article_1'].title
    assert_equal 'Another', articles['article_2'].title
    assert_equal 'I love this', articles['Test'].title
    
    assert_equal 'title 3', articles['Auto3'].title
  end

  def test_global
    Fixtures.load User, Article    
    assert_equal 3, Fixtures.user.size
    assert_equal 'This is cool', Fixtures.article['article_1'].title
  end
    
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
glue-0.22.0 test/glue/tc_fixture.rb
glue-0.23.0 test/glue/tc_fixture.rb
glue-0.24.0 test/glue/tc_fixture.rb
glue-0.25.0 test/glue/tc_fixture.rb
glue-0.26.0 test/glue/tc_fixture.rb
glue-0.27.0 test/glue/tc_fixture.rb
glue-0.28.0 test/glue/tc_fixture.rb
glue-0.29.0 test/glue/tc_fixture.rb