small medium large xlarge

Generic-user-small
02 May 2010, 15:44
Dominik H. (2 posts)

Hey there!

I just got this error message:

  1) Failure:
test_product_is_not_valid_without_a_unique_title(ProductTest) [/test/unit/product_test.rb:68]:
<"has already been taken"> expected but was
<"has already been takenis too short (minimum is 10 characters)">.

  2) Failure:
test_product_is_not_valid_without_a_unique_title_-_i18n(ProductTest) [/test/unit/product_test.rb:78]:
<"has already been taken"> expected but was
<"has already been takenis too short (minimum is 10 characters)">.

5 tests, 23 assertions, 2 failures, 0 errors

The problem was that I added:

validates :title, :length => {:minimum => 10}

to product.rb as suggested in iteration b2 Playtime (pdf page 101).

What do I need to change to make them work together?

Samr_small_pragsmall
03 May 2010, 02:55
Sam Ruby (634 posts)

If you take a look at page 96, you will see the test data used for products. Change the first title in test/fixtures/products.yml to something longer than 10 characters.

Generic-user-small
15 Nov 2010, 01:53
Kabir Mohammed (3 posts)

I am also facing the same problem. PDF version 10.0

Loaded suite /home/—–/.rvm/gems/ruby-1.9.2-p0/gems/rake-0.8.7/lib/rake/rake_test_loader Started ..EE. Finished in 0.738581 seconds.

1) Error: test_product_is_not_valid_without_a_unique_title(ProductTest): StandardError: No fixture with name ‘ruby’ found for table ‘products’ /home/—–/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:899:in block (3 levels) in setup_fixture_accessors' /home/-----/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:893:in map’ /home/—–/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:893:in block (2 levels) in setup_fixture_accessors' test/unit/product_test.rb:61:in block in '

2) Error: test_product_is_not_valid_without_a_unique_title_-_i18n(ProductTest): StandardError: No fixture with name ‘ruby’ found for table ‘products’ /home/—–/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:899:in block (3 levels) in setup_fixture_accessors' /home/-----/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:893:in map’ /home/—–/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.1/lib/active_record/fixtures.rb:893:in block (2 levels) in setup_fixture_accessors' test/unit/product_test.rb:71:in block in '

5 tests, 19 assertions, 0 failures, 2 errors, 0 skips

Test run options: –seed 48227 rake aborted! Command failed with status (1): [/home/—–/.rvm/rubies/ruby-1.9.2-p0/bin/…]

You must be logged in to comment