When I ran "bundle exec rspec spec / system / tasks_spec.rb" on the terminal in Chapter 5-8 of the Ruby on Rails5 Quick Learning Practice Guide, I was addicted to the following error. It is the memorandum.
Failures:
1)Task management function list function display When user A is logged in, the tasks created by user A are displayed.
Failure/Error: user_a = FactoryBot.create(:user, name: 'User A', email: '[email protected]')
ArgumentError:
Factory not registered: user
# /Library/Ruby/Gems/2.6.0/gems/factory_bot-4.11.1/lib/factory_bot/registry.rb:24:in `find'
# /Library/Ruby/Gems/2.6.0/gems/factory_bot-4.11.1/lib/factory_bot/decorator.rb:10:in `method_missing'
# /Library/Ruby/Gems/2.6.0/gems/factory_bot-4.11.1/lib/factory_bot.rb:100:in `factory_by_name'
# /Library/Ruby/Gems/2.6.0/gems/factory_bot-4.11.1/lib/factory_bot/factory_runner.rb:12:in `run'
# /Library/Ruby/Gems/2.6.0/gems/factory_bot-4.11.1/lib/factory_bot/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/system/tasks_spec.rb:7:in `block (3 levels) in <top (required)>'
Finished in 5.33 seconds (files took 1.31 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/system/tasks_spec.rb:19 #Task management function list function display When user A is logged in, the tasks created by user A are displayed.
Directory name misspelled
You have to be careful not to make a typo in the directory name ...
Recommended Posts