I got following problem: In my application i use inheritance to define my user model:
class User
include Mongoid::Document
field :name...
field :bla...
e
Just add the class: CustomUser to :custom_user factory. That works for me. When you nested in :user it means parent is User, but it is simpler.
FactoryGirl.define do
factory :user do
name "name"
bla "bla"
factory :custom_user, class: CustomUser do
customfield "customfield"
end
end
end
You can try this:
factory :user do
name "name"
bla "bla"
end
factory :custom_user, class: CustomUser, parent: :user do
customfield "customfield"
end
For more info: Inheritance.