Top "Factory-bot" questions

factory_bot is a Ruby gem that allows you to quickly define prototypes for each of your models and ask for instances with properties that are important to the test at hand.

How can I create unique strings (with no numbers) with factory girl?

Or is an external gem necessary to generate random and unique usernames maybe? Here's my current factory: factory :user_4 do …

ruby-on-rails ruby factory-bot
How to handle foreign key in FactoryGirl

I have a user model and a follower model, such that a user can have many followers. So in schema …

ruby-on-rails ruby-on-rails-4 factory-bot faker
Factory Girl pass parameter to trait

I've been banging my head over this. I want to be able to overwrite attributes on top of traits. I've …

ruby-on-rails factory-bot minitest
RSPEC and factory girl SystemStackError: stack level too deep

I have trying to solve an issue with my Spec tests and I get the following error Failures: 1) SessionsController POST …

ruby-on-rails rspec factory-bot factory
Where do I confirm user created with FactoryGirl?

Using rails, devise, rspec & factorygirl: Trying to create some tests for my site. I'm using the confirmable model for …

ruby-on-rails rspec factory-bot devise-confirmable
How to include a module in a factory_girl factory?

I'm trying to reuse a helper method in all my factories, however I cannot get it to work. Here's my …

ruby-on-rails module mixins factory-bot
has_many while respecting build strategy in factory_girl

Situation # Models class User < ActiveRecord::Base has_many :items end class Items < ActiveRecord::Base belongs_to :user validates_…

ruby-on-rails ruby unit-testing factory-bot
FactoryGirl initialize_with multiple params

I have a model with multiple params in initialize, one of which is used in a method on the model …

ruby-on-rails ruby factory-bot factories