Last active
March 20, 2020 05:52
-
-
Save jmcervera/7ca396f0ed4a2fe2fc66efbacd6903dc to your computer and use it in GitHub Desktop.
Trying to use factory_rom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#spec/rom_factories/users.rb | |
RomFactory::Builder.define do |b| | |
b.factory(relation: :users, name: :user_1) do |f| | |
f.id "ID1" | |
f.name "John" | |
f.surname "Doe" | |
end | |
end | |
RomFactory::Config.configure do |config| | |
config.container = App['persistence.rom'] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/spec/persistence/users_spec.rb | |
require 'spec_helper' | |
require File.expand_path('../../rom_factories/users', __FILE__) | |
RSpec.describe "accessing users" do | |
it 'creates user in db' do | |
user = RomFactory::Builder.create(:user_1) | |
expect(user.name).to eq 'John' | |
end | |
end | |
# The error I'm getting is "ArgumentError: Factory user_1 does not exist" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you resolve this error afterall?