Forum: Ruby on Rails unittest, not loading yml data

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8c786b59665b31d9e43da6c5e6315a4d?d=identicon&s=25 Mohammad Khan (Guest)
on 2006-03-04 04:54
(Received via mailing list)
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
Bf66e10c8fc4abefebde0425e7f6f15a?d=identicon&s=25 Norman Timmler (Guest)
on 2006-03-05 13:39
(Received via mailing list)
Am Freitag, den 03.03.2006, 22:51 -0500 schrieb Mohammad Khan:
>   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 Timmler

http://blog.inlet-media.de
8c786b59665b31d9e43da6c5e6315a4d?d=identicon&s=25 Mohammad Khan (Guest)
on 2006-03-06 20:26
(Received via mailing list)
Hi Norman,

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

Mohammad
This topic is locked and can not be replied to.