require "rails_helper"

RSpec.describe ProjectMembershipPolicy, type: :policy do
  subject { described_class }

  let(:user_context) { build(:user_context, user: user, account: user.primary_account) }

  context "for an associate" do
    let(:user) { create(:user, :associate) }

    permissions :create? do
      it { is_expected.not_to permit(user_context, subject) }
    end
    permissions :destroy? do
      it { is_expected.not_to permit(user_context, subject) }
    end
  end

  context "for manager" do
    let(:user) { create(:user, :manager) }

    permissions :create? do
      it { is_expected.to permit(user_context, subject) }
    end
    permissions :destroy? do
      it { is_expected.to permit(user_context, subject) }
    end
  end
end
