Category "factory-bot"

How to have a factory in multiple files

I have a model that is used by multiple libs, each of these libs is using it with different approaches. For the moment I made a factory file, which contains mul

"Undefined method `build'" when using Rspec + FactoryBotRails

I'm trying this gem called FactoryBotRails. For some reason, when I try it on one of my models unit tests, the following error is thrown. Failure/Error: my_

Rspec Capybara Failure/Error: DatabaseCleaner.clean

I am using rails 6.1.4 (Ubuntu 20.04) and am running tests with rspec, factorybot, and capybara. I also got database_cleaner where I'm using :truncation to star

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 been reading the documentation and some internet examples

Capybara and Factorybot - created data does not appear

I am facing a wired issue, factoryBot is creating a record in Db, but when capybara try to access it, there is no record in HTML. I tried debugging with "byebu

Remove associations when using a Factory with associations

I have a simple :item factory with a nested attachment that is working fine. FactoryGirl.define do factory :item do before_create do |item| item.a

Is it possible to use Factory Girl to update an already instanced factory?

I am trying to streamline our cukes trying to leverage the wonderful factories built into our system for unit tests. I am setting up a @bread ||= FactoryGirl.cr

AssociationTypeMismatch and FactoryGirl

This has been causing some frustration recently... It seems that using Factories in my cucumber tests, in some situations causes AssociationTypeMismatch error