Unittest, not loading yml data


#1

Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project
image_url: /images/sk_auto_small.jpg
price: 29.95
date_available: 2004-07-01 00:00:00

and I was trying to use @products and @version_control_book in my
product_test.rb script
here is my test_product.rb
require File.dirname(FILE) + ‘/…/test_helper’
class ProductTest < Test::Unit::TestCase
fixtures :products

def setup
    @product = Product.find(1)
end

def test_load_yml
    assert_equal nil, @products
    assert_equal nil, @version_control_book
    assert_equal nil, @automation_book
end

end

And here is what I am getting from product_test.rb,
[beeplove@localhost depot]$ ruby test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
.
Finished in 0.143878 seconds.

1 tests, 3 assertions, 0 failures, 0 errors

I was expecting to see 1 failure and 3 errors. Am I doing something
wrong?

Mohammad


#2

Am Freitag, den 03.03.2006, 22:51 -0500 schrieb Mohammad K.:

title: Pragmatic Project Automation
fixtures :products
end

I was expecting to see 1 failure and 3 errors. Am I doing something wrong?

Have you set instantiated fixtures set to true in your
test/test_helper.rb file?

self.use_instantiated_fixtures = true


Norman T.

http://blog.inlet-media.de


#3

Hi Norman,

Thanks for your reply.
I think, Agile Web D. book is missing this part.

Mohammad