'ActiveRecord::RecordInvalid: Validation failed: Visited can't be blank

When running bundle exec rspec, I am getting the error message ActiveRecord::RecordInvalid: Validation failed: Visited can't be blank. I have defined visited in spec/factories/items.rb but not sure why I am getting this error message. Please help.

FactoryBot.define do
  factory :item do
    name { Faker::Movies::StarWars.character }
    location { Faker::Movies::HarryPotter.location }
    activity_type { Faker::Movies::HarryPotter.spell }
    recommended { Faker::Movies::HarryPotter.book }
    link { Faker::Internet.url }
    recommended_temperature { Faker::Movies::HarryPotter.quote }
    transportation { Faker::Movies::HarryPotter.house }
    budget { Faker::Number.number(digits: 100) }
    visited { Faker::Boolean.boolean }
    created_by { Faker::Movies::HarryPotter.character }
  end
end

This is my db/schema.rb:


ActiveRecord::Schema.define(version: 2022_03_16_153346) do

  create_table "items", force: :cascade do |t|
    t.string "name"
    t.string "location"
    t.string "activity_type"
    t.string "recommended"
    t.string "link"
    t.string "recommended_temperature"
    t.string "transportation"
    t.integer "budget", limit: 8
    t.boolean "visited"
    t.string "created_by"
    t.datetime "created_at", precision: 6, null: false
    t.datetime "updated_at", precision: 6, null: false
  end

end


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source