14 Aug 2013, 11:01
Generic-user-small

Emmanuel Mensah (2 posts)

not sure what i’m doing wrong but i copied and pasted this code and rerun rake test but still had 2 failures as before.

Iteration B1: Validating! • 85

14 Aug 2013, 13:42
Samr_small_pragsmall

Sam Ruby (584 posts)

can you copy/paste the errors you are seeing?

14 Aug 2013, 22:00
Generic-user-small

Emmanuel Mensah (2 posts)

This is what I got (below). Now it reports 4 errors and now ahead of the the page i was on (85).

(# Running tests:

(F…FF…..F.

(Finished tests in 0.236750s, 54.9102 tests/s, 109.8205 assertions/s.

(1) Failure: (ProductTest#test_image_url [/Users/emKaro/Desktop/depot/test/models/product_test.rb:52]: (fred.gif should be valid

(2) Failure: (ProductTest#test_product_price_must_be_positive [/Users/emKaro/Desktop/depot/test/models/product_test.rb:36]: (Failed assertion, no message given.

(3) Failure: (ProductsControllerTest#test_should_create_product [/Users/emKaro/Desktop/depot/test/controllers>(/products_controller_test.rb:26]: (“Product.count” didn’t change by 1. (Expected: 4 (Actual: 3

(4) Failure: (ProductsControllerTest#test_should_update_product [/Users/emKaro/Desktop/depot/test/controllers>(/products_controller_test.rb:47]: (Expected response to be a , but was <200>

(13 tests, 26 assertions, 4 failures, 0 errors, 0 skips)

04 Nov 2013, 11:49
Generic-user-small

Juergen Scholtes (2 posts)

Same for me.

When i enter fred.gif in the Form via Browser it is accepted but the rake test fails with “fred.gif should be valid”

regards Juergen

08 Nov 2013, 02:30
Generic-user-small

Tony Kyle (6 posts)

Dang it, I thought I saved my comment.

Tried to paste my unit tests here but it formats it funny and makes it unusable.

This item though gave me no errors typing directly from the book. Without seeing the unit tests in question it is difficult to understand what may be causing the unit test failures.

Take care,

16 Nov 2013, 12:35
Generic-user-small

Juergen Scholtes (2 posts)

Ok, found my mistake in depot/test/models/product_test.rb:

def new_product(image_url)
  Product.new(title: "Test Book",
                      description: "test",
                      image_url: image_url)
end

The use of this new_product will always fail, because the price is missing. In this case the error message is always “image_url shoud be valid”.

So, indeed be careful to enter valid test data.

  You must be logged in to comment