require 'rails_helper'

RSpec.describe Material, type: :model do
  let(:user) { create(:user, :member) }

  it 'allows only material source kinds, not suppression prefix kinds' do
    material = described_class.new(url: 'https://example.com/material',
                                   source_kind: 'google_drive_path_prefix',
                                   source_path: '素材/危険',
                                   created_by_user: user,
                                   updated_by_user: user)

    expect(material).not_to be_valid
    expect(material.errors[:source_kind]).to be_present

    material.source_kind = 'google_drive_path'
    expect(material).to be_valid
  end
end
