title: Rails Rspec tests error ActiveRecord::AssociationTypeMismatch: School(#17400) expected, got "" which is an instance of String(#120)
body: <p>I'm having problems with RSpec when generating tests for my event model. This message appears, and I can't solve it</p>
  <pre><code>require 'rails_helper'
  
  RSpec.describe &quot;Events&quot;, type: :request do
    include Docs::V1::Events::Api
  
    it_behaves_like 'basic crud', :event, %w[title description event_type user_id status school_id grade_id classroom_id event_date start_time end_time participants],
                    []
  end
  </code></pre>
  <p>Event Schema:</p>
  <pre><code>create_table &quot;events&quot;, force: :cascade do |t|
      t.string &quot;title&quot;
      t.string &quot;description&quot;
      t.string &quot;event_type&quot;
      t.bigint &quot;user_id&quot;
      t.string &quot;status&quot;
      t.bigint &quot;school_id&quot;
      t.bigint &quot;grade_id&quot;
      t.bigint &quot;classroom_id&quot;
      t.datetime &quot;event_date&quot;
      t.datetime &quot;start_time&quot;
      t.datetime &quot;end_time&quot;
      t.integer &quot;participants&quot;, default: [], array: true
      t.index [&quot;classroom_id&quot;], name: &quot;index_events_on_classroom_id&quot;
      t.index [&quot;grade_id&quot;], name: &quot;index_events_on_grade_id&quot;
      t.index [&quot;school_id&quot;], name: &quot;index_events_on_school_id&quot;
      t.index [&quot;user_id&quot;], name: &quot;index_events_on_user_id&quot;
    end
  </code></pre>
  <p>Event Model:</p>
  <pre><code>Class Event &lt; ApplicationRecord
    has_one_attached :file, dependent: :destroy
  
    belongs_to :user
    belongs_to :school, optional: true
    belongs_to :grade, optional: true
    belongs_to :classroom, optional: true
  
    validates :event_type, presence: true
  </code></pre>
  <p>Maybe the line with belongs_to :school is the problem because when I added it the Rspec tests were showing a different error</p>