require "rails_helper"

describe MedicalReleasePolicy do
  let(:user_context) { build(:user_context) }

  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
    context "for a native release" do
      it { is_expected.not_to permit(user_context, build(:medical_release, :native)) }
    end

    context "for a non-native release" do
      it { is_expected.to permit(user_context, build(:medical_release, :non_native)) }
    end
  end

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

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

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