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
Am Freitag, den 03.03.2006, 22:51 -0500 schrieb Mohammad Khan:> 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?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
Hi Norman, Thanks for your reply. I think, Agile Web Development book is missing this part. Mohammad On 3/5/06, Norman Timmler <lists@inlet-media.de> wrote:> Am Freitag, den 03.03.2006, 22:51 -0500 schrieb Mohammad Khan: > > 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? > > 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 > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >