infocritic (2) [Avatar] Offline
I am working through the 'restricting actions to admins only' section and I cannot figure out factory girl. I *think* I have followed all the steps properly but when I get past listing 7.6 on page 141, I cannot get RSpec to recognize the :user factory. I get the following error:

1) ProjectsController standard users cannot access the new action
Failure/Error: user = Factory(:user)
Factory not registered: user
# ./spec/controllers/projects_controller_spec.rb:5:in `block (2 levels) in <top (required)>'
# ./spec/controllers/projects_controller_spec.rb:13:in `block (3 levels) in <top (required)>'

I have googled it and roamed through StackOverflow with no success.

Note that if I change the Gemfile gem from factory_girl to factory_girl_rails, RSpec works, but Cucumber fails. If I leave the gem pointing to factory_girl, my Cucumber steps all pass, but I get this RSpec failure. Any idea what I am doing wrong?

jason.prins (4) [Avatar] Offline
Re: Chapter 7.3 Factory Girl Problem
Did you create the new file at spec/support /factories.rb and put this content

[pre] Dir[Rails.root + "factories/*.rb"].each do |file|
require file

in it?
infocritic (2) [Avatar] Offline
Re: Chapter 7.3 Factory Girl Problem
That did the trick. Thank you. I have no idea how I missed that file. I know I read the instructions in the book.
ryanbigg (423) [Avatar] Offline
Re: Chapter 7.3 Factory Girl Problem
Thanks Jason for answering this!
ntndeva (3) [Avatar] Offline
Re: Chapter 7.3 Factory Girl Problem
I'm questioning if a person might support me out! Actually I desire to watch this particular blog at my personal brand-new iPad, but it doesn't present up correctly, So I used to be asking yourself if an individual can propose me any optimum remedy?Manali Tour | Manali Tour Package