Factory not registered

You have your factory definition in the wrong file, according to your question it is in user.rb. This needs to be in a factories.rb in your test folder (spec) if you use rspec

# user.rb

FactoryGirl.define do
    factory :user do |f|
        f.email "aabb@hh.de"
        f.password "ruby"
        f.password_confrimation "ruby"
    end
end

Change above to this, (Also you don’t need the f variable)

# spec/factories.rb

FactoryGirl.define do
    factory :user do
        email "aabb@hh.de"
        password "ruby"
        password_confrimation "ruby"
    end
end

Also as the comments say, make sure gem 'factory_girl_rails' is in your Gemfile, instead of just gem 'factory_girl'

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)