I’m using Rails 6.2, Ruby 2.7.5 and RSpec 3.10.1. When testing an association, I’m getting a strange error…
Expected Voyage to have a belongs_to association called user (and for the record to fail validation if :user is unset; i.e., either the association should have been defined with `required: true`, or there should be a presence validation on :user)
I’m confused about what this error means. Below my model is
class Voyage < ActiveRecord::Base
…
belongs_to :user, required: true
And the spec is
describe Voyage, :type => :model do
describe 'associations' do
it { should belong_to :user }