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.

Factory-girl create that bypasses my model validation

I am using Factory Girl to create two instances in my model/unit test for a Group. I am testing …

ruby-on-rails ruby-on-rails-3 rspec factory-bot rspec-rails
How do I simulate a login with RSpec?

I have been playing with Rails for a couple of years now and have produced a couple of passable apps …

ruby-on-rails rspec factory-bot
Testing the User Model with Rspec, Devise, and Factory Girl

I think there is a problem with my user factory being built. I'm getting an error saying that the password …

ruby-on-rails ruby rspec devise factory-bot
Factory already registered: user (FactoryGirl::DuplicateDefinitionError)

Description of problem: - I've setup factory_girl_rails however whenever I try and load a factory it's trying to …

ruby-on-rails factory-bot ruby-on-rails-3.2
How to test model's callback method independently?

I had a method in a model: class Article < ActiveRecord::Base def do_something end end I also had …

ruby-on-rails ruby-on-rails-3 activerecord rspec factory-bot
FactoryGirl and polymorphic associations

The design I have a User model that belongs to a profile through a polymorphic association. The reason I chose …

ruby-on-rails factory-bot
RSpec gives error 'trait not registered: name'

I tried to test my Rails 3 application on Windows with RSpec. I've wrote tests and factories, but can't solve the …

ruby-on-rails-3 rspec factory-bot
Find or create record through factory_girl association

I have a User model that belongs to a Group. Group must have unique name attribute. User factory and group …

ruby ruby-on-rails-3 cucumber factory-bot
factory girl passing arguments to model definition on build/create

models/message.rb class Message attr_reader :bundle_id, :order_id, :order_number, :event def initialize(message) hash = message @bundle_…

ruby-on-rails ruby factory-bot rspec-rails
Factory Girl - what's the purpose?

What's the purpose of Factory Girl in rspec tests when I could use before(:each) blocks? It feels like the …

ruby factory-bot