require "rails_helper"

RSpec.describe OrganizationMembership, type: :model do
  describe "validations" do
    subject { build(:organization_membership) }

    it { is_expected.to validate_presence_of(:user_id) }
    it { is_expected.to validate_presence_of(:organization_id) }
    it { is_expected.to validate_presence_of(:type_of_user) }
    it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:organization_id) }
    it { is_expected.to validate_inclusion_of(:type_of_user).in_array(%w[admin member guest]) }
  end
end
