Error Factory_girl Not Found
Contents |
Sign in Pricing Blog Support Search GitHub This repository Watch 52 Star error factorygirl not found 1,676 Fork 207 thoughtbot/factory_girl_rails Code Issues 16 Pull requests factory balls 7 Projects 0 Pulse Graphs New issue fixture_replacement in generators does not work #53
Factory Not Registered Rspec
Closed AntonTrapp opened this Issue Mar 30, 2012 · 19 comments Projects None yet Labels None yet Milestone No milestone Assignees
Factorygirl Factory
No one assigned 8 participants AntonTrapp commented Mar 30, 2012 application.rb: config.generators do |g| g.fixture_replacement :factory_girl, :dir => "spec/factories" ... leads to: rails g model test dummy ... invoke factory_girl Could not find "fixtures.3.rb" in any of your source paths. If I remove the fixture_replacement the rails generators factorygirl::duplicatedefinitionerror work again. thoughtbot, inc. member joshuaclayton commented Mar 30, 2012 What version of rails are you using? AntonTrapp commented Mar 30, 2012 3.2.0 thoughtbot, inc. member joshuaclayton commented Mar 30, 2012 Weird - I just tried with a 3.2.2 app and it works fine. What version of factory_girl_rails are you using? I tried with 3.0.0 and it worked without a hitch. AntonTrapp commented Mar 30, 2012 Yes, weird - but on the other side: one of the gems is always itching ;) factory_girl (3.0.0) factory_girl_rails (3.0.0) Maybe a side effect with another gem? rspec? rails3-generators? shoulda? Anything known? *** LOCAL GEMS *** actionmailer (3.2.0) actionpack (3.2.0) activemodel (3.2.0) activerecord (3.2.0) activeresource (3.2.0) activesupport (3.2.0) addressable (2.2.7) arel (3.0.2) autotest (4.4.6) awesome_print (1.0.2) bcrypt-ruby (3.0.1) builder (3.0.0) bundler (1.1.3) cancan (1.6.7) capybara (1.1.2) childprocess (0.3.1) chronic (0.6.7) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-scri
Sign in Pricing Blog Support Search GitHub This repository Watch 117 Star 5,004
Factory Not Registered User
Fork 1,103 thoughtbot/factory_girl Code Issues 8 Pull requests 6 Projects uninitialized constant factorygirl 0 Wiki Pulse Graphs New issue Factories Not Automatically Loaded Like the Docs Say #793 factorygirl rspec Closed sshaw opened this Issue Jul 1, 2015 · 7 comments Projects None yet Labels None yet Milestone No milestone Assignees No https://github.com/thoughtbot/factory_girl_rails/issues/53 one assigned 5 participants sshaw commented Jul 1, 2015 In GETTING_STARTED: Factories can be defined anywhere, but will be automatically loaded if they are defined in files at the following locations: ... Under 4.5.0 this is not true, the provided paths are in FactoryGirl.definition_file_paths, but one must explicitly call https://github.com/thoughtbot/factory_girl/issues/793 FactoryGirl.find_definitions for them to be found. Otherwise, a Factory not registered error will be raised. Small example: # spec/spec_helper RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods end # spec/foo_spec.rb require "spec_helper" RSpec.describe Foo do describe "#bar" do it "does some thangz" do # Uncomment this to work # FactoryGirl.find_definitions p FactoryGirl.definition_file_paths p FactoryGirl.factories foo = build(:foo) end end end sshaw commented Jul 1, 2015 Note that this is with Bundler, though I'm also using Padrino so... dmolesUC3 commented Aug 17, 2015 As a workaround, putting FactoryGirl.find_definitions in the configure block seems to work: RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.before do FactoryGirl.find_definitions end end whithajess commented Nov 16, 2015 I had this same problem did the workaround suggested by @dmolesUC3 and found that it would work for the first spec then fail on the next because of duplicate definitions. My workaround: FactoryGirl.find_definitions if FactoryGirl.factories.count == 0 Will try see if
Sign in Pricing Blog Support Search GitHub This repository Watch 117 Star 5,004 Fork 1,103 thoughtbot/factory_girl Code Issues 8 Pull requests 6 Projects 0 https://github.com/thoughtbot/factory_girl/issues/194 Wiki Pulse Graphs New issue Argument Error: Not registered using factory_girl 1.1.0 with rails 3.1.0.rc8 #194 Closed matthewbga opened this Issue Aug 29, 2011 · 4 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants matthewbga commented Aug 29, 2011 I am working on a Mountable Engine in rails 3.1.0.rc8 not found and am getting "Argument Error: Not registered: user1" when I run factory_girl. Reading #168, I see where you suggested the dev to run FactoryGirl.definition_file_paths from rails console. Suspecting the same issue, I tried this, and received: => ["/Users/mab/Documents/Development/mountable_engine_tests/gemmy/spec/dummy/test/factories", "/Users/mab/Documents/Development/mountable_engine_tests/gemmy/spec/dummy/spec/factories"] Since this is a mountable engine, I had been putting the specs, fixtures, and everything in Users/mab/Documents/Development/mountable_engine_tests/gemmy/spec, WITHOUT the /dummy. So factory not registered my factories are in Users/mab/Documents/Development/mountable_engine_tests/gemmy/spec/factories. According to the docs I've been reading on mountable engines everywhere, the factories should not be under dummy. Can you advise? TIA, -Matt Any advice on how to repair this? thoughtbot, inc. member joshuaclayton commented Aug 31, 2011 Are the factories part of the engine or part of your tests for the engine? I'm not too sure I understand what you're trying to achieve here. matthewbga commented Aug 31, 2011 Haha, thanks for the reply, joshuaclayton. I may well be the issue here! I have a models-only engine I want to use among three separate projects, so I only need model testing in the Engine, but I do want to have it there. My thinking was to use the Mountable Engine for this purpose. At this point I've pulled back from making it mountable as in this case I don't need the namespacing, and the magic-luggage with --mountable appears to have been causing me trouble. I was able to get around the issue with factory_girl, however, by putting the following in my spec_helper.rb. FactoryGirl.definition_file