Comments (19)
also worked for me w/ following:
Gemfile
group :development do
gem "factory_girl_rails"
end
config/application.rb
config.generators do |g|
g.test_framework :rspec, :fixture => true, :views => false
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
from factory_bot_rails.
What version of rails are you using?
from factory_bot_rails.
3.2.0
from factory_bot_rails.
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.
from factory_bot_rails.
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-script-source (1.2.0)
commonjs (0.2.5)
country_select (0.0.2)
cucumber (1.1.9)
cucumber-rails (1.3.0)
database_cleaner (0.7.2)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.3.0)
factory_girl (3.0.0)
factory_girl_rails (3.0.0)
ffi (1.0.11)
gherkin (2.9.3)
haml (3.1.4)
haml-rails (0.3.4)
hike (1.2.1)
hirb (0.6.2)
hirb-unicode (0.0.5)
hpricot (0.8.6)
i18n (0.6.0)
journey (1.0.3)
jquery-rails (2.0.1)
json (1.6.6)
launchy (2.1.0)
less (2.0.12)
less-rails (2.1.8)
libv8 (3.3.10.4 x86_64-darwin-11)
mail (2.4.4)
mime-types (1.18)
multi_json (1.2.0)
mysql2 (0.3.11)
nokogiri (1.5.2)
orm_adapter (0.0.7)
paper_trail (2.6.3)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.0)
rails3-generators (0.17.4)
railties (3.2.0)
rake (0.9.2.2)
rdoc (3.12)
rspec (2.9.0)
rspec-core (2.9.0)
rspec-expectations (2.9.0)
rspec-mocks (2.9.0)
rspec-rails (2.9.0)
ruby_parser (2.3.1)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.5)
selenium-webdriver (2.20.0)
sexp_processor (3.1.0)
shoulda (3.0.1)
shoulda-context (1.0.0)
shoulda-matchers (1.0.0)
simple_form (2.0.1)
simplecov (0.6.1)
simplecov-html (0.5.3)
sprockets (2.1.2)
term-ansicolor (1.0.7)
therubyracer (0.9.10)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
twitter-bootstrap-rails (2.0.4)
tzinfo (0.3.32)
uglifier (1.2.4)
unicode-display_width (0.1.1)
warden (1.1.1)
whenever (0.7.3)
xpath (0.1.4)
ZenTest (4.7.0)
from factory_bot_rails.
Can you paste your Gemfile.lock and your config/application.rb? My guess is that it may be another generator, but I'm not positive. I've tried a couple of different Rails versions, with and without the fixture_replacement
defined in the config (it gets used by default). If it generates the factories for you, I'd just remove it.
from factory_bot_rails.
Sure! Glad if I can help, really love this girl ;)
Gemfile.lock: https://gist.github.com/2252137
application.rb: https://gist.github.com/2252149
from factory_bot_rails.
I've got nothing... sorry. Here's a repo that I made with what looks to be the core pieces of fixtures and the rails app: https://github.com/joshuaclayton/fgr_fixture_replacement_example Walk through the commits and you can see what I did (I even outlined the commands I ran). If you can find a way to reproduce in a similar fashion, that'd be great. The only thing I notice a difference in is the patch version of Rails, so try bumping up to 3.2.2. If that doesn't work, finding a way to reproduce will be the only way you can help me I think. Once you find a way to repro, reopen this issue if you could. Thanks!
from factory_bot_rails.
Thanks, I figure it out this weekend and will be back again (with a reproduction of the error or the solution to the problem)...
from factory_bot_rails.
I have almost same problem.
This problem is made by FactoryGirls version 3.0.0.
/lib/generators/factory_girl/model/model_generator.rb
module FactoryGirl
module Generators
class ModelGenerator < Base
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
class_option :dir, :type => :string, :default => "test/factories", :desc => "The directory where the factories should go"
def create_fixture_file
version = nil
begin
require 'factory_girl/version'
version = FactoryGirl::VERSION.to_i
rescue LoadError
require 'factory_girl'
version = Factory::VERSION.to_i
rescue Object => e
raise "Please install Factory_girl or add it to your Gemfile"
end
template "fixtures.#{version}.rb", File.join(options[:dir], "#{table_name}.rb")
end
end
end
end
with factory_girl 3.0.0 , generator should find fixture for version 3
template "fixtures.#{version}.rb", File.join(options[:dir], "#{table_name}.rb")
Now, fixture templates for factory_girl are just 'fixtures.1.rb, fixtures.2.rb' in template directory.
So you could solve this problem just to copy fixtures.2.rb to fixtures.3.rb in generators/factory_girl/model/templates
I could find exact solution. (ye.. I need solution right now.) See below comments
from factory_bot_rails.
hm. This situation is slightly complex.
factory_girl_rails have fixture generator for factory_girl. This feature moved from rails3-generator 5 month ago.
But rails3-generator 0.17.4 gem have factory_girl generator yet.
And, even if factory_girl fixture generators are removed from current rails3-generator master source,
master branch have useless 'generators/factory_girl.rb' file yet.
So if you point with 'gem rails3-generator, :git => https://github.com/indirect/rails3-generators.git', you could not solve this problem. ;;
I made temporal solution for me in 'https://github.com/neocoin/rails3-generators.git' 3 minute ago.
I just remove factory_girl generator.... (Also I requested pull to master)
So you could use temporal solution below until this patch will apply master version. Or fork me and use user repository.
group :development do
gem 'factory_girl_rails'
gem "rails3-generators", :git => "https://github.com/neocoin/rails3-generators.git"
end
good luck.
from factory_bot_rails.
Yeah, it looks like rails3-generators
is the culprit. My recommendation is removing the gem until the rails3-generators
gem removes the factory_girl
generator and bumps the gem version. Good luck!
from factory_bot_rails.
I am having the same issue. I uninstalled the rails3-generators
gem but I am still having the same issue.
application.rb
config.generators do |g|
g.test_framework :rspec, fixture: true
g.fixture_replacement :factory_girl, dir: 'spec/factories'
g.form_builder :simple_form
g.template_engine :haml
end
Here is my command:
Usage:
rails generate oauth_provider [NAME] [options]
Options:
[--skip-namespace] # Skip namespace (affects only isolated applications)
[--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
-o, [--orm=NAME] # Orm to be invoked
# Default: active_record
-t, [--test-framework=NAME] # Test framework to be invoked
# Default: rspec
-e, [--template-engine=NAME] # Template engine to be invoked
# Default: haml
Rspec options:
[--fixture] # Indicates when to generate fixture
# Default: true
[--fixture-replacement=NAME] # Fixture replacement to be invoked
# Default: factory_girl
And here is the output:
invoke rspec
create spec/controllers/oauth_clients_controller_spec.rb
create spec/models/client_application_spec.rb
create spec/models/oauth_token_spec.rb
create spec/models/oauth2_token_spec.rb
create spec/models/oauth2_verifier_spec.rb
create spec/models/oauth_nonce_spec.rb
error factory_girl [not found]
from factory_bot_rails.
@joshuaclayton - sorry for the delay, I can confirm that removing and uninstalling the rails3-generators
solves the issue for me too.
Thank you very much!
from factory_bot_rails.
@mmastoras grazie, that worked.
from factory_bot_rails.
Thank you @mmastoras that worked for our app.
from factory_bot_rails.
@mmastoras Thank you, worked for me too!
from factory_bot_rails.
@mmastoras When I tried your solution I got this:
/Users/pkat/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/pkat/.rvm/gems/ruby-1.9.3-p448/gems/nokogiri-1.6.0/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /Users/pkat/.bundler/tmp/25324/gems/nokogiri-1.6.0/ports/i686-apple-darwin11/libxml2/2.8.0/lib/libxml2.2.dylib (LoadError)
from factory_bot_rails.
@pavankat it looks Nokogiri was compiled against a (now-?)nonexistent version of libxml.
from factory_bot_rails.
Related Issues (20)
- Model generation ignores --force-plural HOT 3
- Rails ignoring factory HOT 2
- Install fewer gems on Travis HOT 1
- Incompatibility with Rails 6.0.3? HOT 2
- Perform DB migration will make factory_bot looking for methods in the wrong place HOT 2
- Successive associations issue when migrating to rails 6.1 HOT 3
- Switch from Travis CI to GitHub Actions
- Duplicate factories problem HOT 5
- Automatically populate attributes and types when generating factories for existing models HOT 2
- Cannot create Factory with multiple traits got (ArgumentError Exception: wrong number of arguments (given 1, expected 0)) Ruby 3.0, Rails 6.1.72, factory_bot_rails 6.1.0 HOT 2
- Dead link in CONTRIBUTING.md HOT 2
- Release new version to allow upgrade to factory_bot 6.3.0 HOT 4
- The railtie included in #419 breaks compatibility with some gems "undefined method `config' for nil:NilClass" Factory Bot > 6.2.0 HOT 5
- 6.3.0: `NoMethodError: undefined method '<' for nil:NilClass` when using a factory with traits HOT 20
- undefined method `config' for nil:NilClass after upgrading to 6.4.0 HOT 16
- Ability to disable reject_primary_key_attributes per factory HOT 11
- RubyGems is not linking the CHANGELOG file
- gemspec is missing required_ruby_version
- FactoryBotRails Generators incorrectly namespace inside Rails Engines
- Fix standard errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from factory_bot_rails.