Found one.

I now use this one : 

RSpec.describe Admin do
  it { is_expected.to respond_to(:name) }
  it { is_expected.to respond_to(:password) }
  it { is_expected.not_to respond_to(:to_model) }
  it { is_expected.not_to respond_to(:compact, :flatten) }
end

but then I see this error message 
:   uninitialized constant Admin (NameError)

Does Devise not make the controller because I do not see any controller 
made by Devise.

Roelof


Op vrijdag 8 augustus 2014 19:51:15 UTC+2 schreef Roelof Wobben:

> Thanks, 
>
> Now I have to find a good example of a rspec 3.0 where  I can test 
> responds_to.
> I found a example but that one does not work. 
>
> Roelof
>
>
> Op vrijdag 8 augustus 2014 18:39:57 UTC+2 schreef Myron Marston:
>
>> On Friday, August 8, 2014 9:25:19 AM UTC-7, Roelof Wobben wrote:
>>>
>>> Hello, 
>>>
>>> I have made this file into spec/models/admin_users.rb 
>>>
>>> require 'rails_helper'
>>>  
>>> RSpec.describe Admin, type: :model do
>>>  
>>> def build_valid_user(opts = {})
>>> valid_opts = {
>>> name: "Example adminUser",
>>> email: "[email protected]",
>>> password: "foobar",
>>> password_confirmation: "foobar",
>>> }
>>> User.new valid_opts.merge(opts)
>>> end
>>>  
>>> it { should respond_to(:name) }
>>> it { should respond_to(:password) }
>>>  
>>> context "given a valid user" do
>>> subject(:any_valid_user) { build_valid_user }
>>>  
>>> it { should be_valid }
>>> end
>>>
>>> but when I do rspec spec/  I see this output: 
>>>
>>>
>>> No examples found.                                                          
>>>                                                                             
>>>                                                                             
>>>                                              
>>>
>>>                                                                             
>>>                                                                             
>>>                                                                             
>>>                                              
>>>
>>>                                                                             
>>>                                                                             
>>>                                                                             
>>>                                              
>>>
>>> Finished in 0.00023 seconds (files took 0.07842 seconds to load)            
>>>                                                                             
>>>                                                                             
>>>                                              
>>> 0 examples, 0 failures                                             
>>>
>>> Roelof
>>>
>>
>> Your file name (spec/models/admin_users.rb) doesn't match the default 
>> value of the `pattern` option:
>>
>>
>> https://relishapp.com/rspec/rspec-core/v/3-0/docs/command-line/pattern-option
>>
>> Rename your file to `spec/models/admin_users_spec.rb` and it should work. 
>>  If you'd like to use an alternate pattern, you can choose a different 
>> value for the `--pattern` option and put it in `.rspec`.
>>
>> 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/e8097090-9cb4-4b93-a12a-cb4f074f799c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to