On Tuesday, December 9, 2014 11:05:26 AM UTC-8, Roelof Wobben wrote:
>
> I will  cut the error message in two. 
>
> the minitest error message : 
>
>
> Warning: you should require 'minitest/autorun' instead.                       
>                                                                               
>              
> Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'     
>
> and the Rspec error message : 
>
>
> Failures:                                                                     
>                                                                               
>              
>
>                                                                               
>                                                                               
>              
>
>   1) Product is valid with a productname, description and a image_url         
>                                                                               
>              
>      Failure/Error: expect(product).to be_valid
>                                                                               
>                                             
>        expected valid? to return true, got false
>                                                                               
>                                            
>
>      # ./spec/model/product_spec.rb:10:in `block (2 levels) in <top 
> (required)>'
>     
>
> Roelof
>

The expectation failure is telling you that `product.valid?` did not return 
true as expected.   It's impossible for us to say what specifically is 
making it invalid.  You'll have to check `product.errors` to see what the 
validation errors are.  It looks like your spec is running without 
rspec-rails loaded (since `be_valid` isn't providing the errors -- the 
default `be_valid` matcher in rspec-expectations just checks `valid?` but 
doesn't know to look for `errors`).  If you load `rspec-rails`, an improved 
`be_valid` matcher is available that will include the validation errors in 
the failure message:

https://github.com/rspec/rspec-rails/blob/v3.1.0/lib/rspec/rails/matchers/be_valid.rb

If you use that, it should pinpoint what the validation error is, and then 
you can fix it.

HTH,
Myron

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/d9955f0c-4970-4749-8351-0e47d9799051%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to