require "rails_helper"

RSpec.describe MusicReleasePolicy do
  let(:user) { create(:user, :manager) }
  let(:user_context) { build(:user_context, user: user, account: user.primary_account) }

  subject { described_class }

  permissions :create? do
    it { is_expected.to permit(:create) }
  end

  permissions :show? do
    it { is_expected.to permit(:show) }
  end

  permissions :update? do
    it { is_expected.to permit(:update) }
  end

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

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

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