On Tuesday, December 9, 2014 11:15:07 PM UTC-8, Roelof Wobben wrote:
>
> Here my repo : https://github.com/roelof1967/commerce-try
>
> Roelof
>
> Op woensdag 10 december 2014 07:42:47 UTC+1 schreef Roelof Wobben:
>
>> I did also rails g rspec:install otherwise rspec do not give output. 
>>
>> Roelof
>>
>>
>> Op woensdag 10 december 2014 00:23:21 UTC+1 schreef Carlos Figueiredo:
>>
>>> Minitest is the default test suite on Rails.
>>>
>>> Did you just installed rspec-rails gem, or did you also run `rails 
>>> generate rspec:install` ?
>>>
>>> Because `rails generate rspec:install` configures you env to run rspec.
>>>
>>> Carlos
>>>
>>> On Tue, Dec 9, 2014 at 7:12 PM, Roelof Wobben <[email protected]> 
>>> wrote:
>>>
>>>>
>>>> I use the rspec rails gem .
>>>>
>>>> I found this in the gem file : 
>>>>
>>>>  gem "rspec-rails", "~> 2.14.0"
>>>>
>>>> If you want , I can upload this project to my personal github page. 
>>>>
>>>> How can I print out the product.errors ?
>>>>
>>>> Roelof
>>>>
>>>> Op dinsdag 9 december 2014 21:53:35 UTC+1 schreef Myron Marston:
>>>>
>>>>> 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/a68be083-ab07-437b-b3ec-4ddb9a978b5d%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/rspec/a68be083-ab07-437b-b3ec-4ddb9a978b5d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
OK, I've taken a look at your repository and discovered a few things:

   -  The minitest warning is triggered by shoulda-matchers.  If you read 
   the changelog[1], you'll notice that 2.6.0 fixes this, so you should 
   upgrade.
   - You're on an old version of RSpec, too -- please upgrade to RSpec 3 [2]
   - The rspec-rails `be_valid` matcher isn't being used in your case 
   because your spec file is in the `spec/model` directory, not the 
   `spec/models` directory.  These sorts of subtleties are why we changed 
   things in RSpec 3 so that spec types aren't auto-inferred by the directory 
   unless you opt in [3], and I'd encourage you to explicitly tag each spec 
   with `:type` metadata (e.g. `:type => :model`).
   - Once you tag the example group or move the spec file to `spec/models`, 
   you'll get the validation errors in the failure message and from there you 
   should be able to address tehm.

HTH,
Myron

[1] https://github.com/thoughtbot/shoulda-matchers/blob/master/NEWS.md
[2] http://rspec.github.io/upgrading-from-rspec-2/
[3] 
http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#filetype_inference_disabled_by_default

-- 
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/70dfdc2c-d38b-460a-ad92-fdf8ed36bb98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to