Sha256: 6ed8dd0239d778fa716317467f0d3577f080451adcba01a3013a687253b31d90

Contents?: true

Size: 799 Bytes

Versions: 7

Compression:

Stored size: 799 Bytes

Contents

require "rails_helper"

describe ManifestationPolicy do
  subject { described_class }
  permissions :destroy? do
    before(:each) do
      @admin = FactoryBot.create(:admin)
    end
    it "grants destroy if it is a simple record." do
      record = FactoryBot.create(:manifestation)
      expect(subject).to permit(@admin, record)
    end
    it "not grants destroy if it is reserved" do
      record = FactoryBot.create(:manifestation)
      reserve = FactoryBot.create(:reserve, manifestation_id: record.id)
      expect(subject).not_to permit(@admin, record)
    end
    it "grants destroy if it is a simple serial record." do
      record = FactoryBot.create(:manifestation_serial)
      policy = Pundit.policy(@admin, record)
      expect(subject).to permit(@admin, record)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
enju_biblio-0.3.2 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.3.1 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.3.0 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.3.0.rc.1 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.3.0.beta.2 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.2.5 spec/policies/manifestation_policy_spec.rb
enju_biblio-0.2.4 spec/policies/manifestation_policy_spec.rb