Sha256: 1c0ae04e94d27a1f569bd6657ca9dfa860922d58882ac621030d48d903e72403

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

describe Sufia::Export::PermissionConverter do
  let(:file) { create :generic_file }
  let(:permission) { file.permissions.first }
  let(:json) { "{\"id\":\"#{permission.id}\",\"agent\":\"http://projecthydra.org/ns/auth/person#archivist1@example.com\",\"mode\":\"http://www.w3.org/ns/auth/acl#Write\",\"access_to\":\"#{file.id}\"}" }

  subject { described_class.new(permission).to_json }

  describe "to_json" do
    it { is_expected.to eq json }

    context "with group permissions" do
      let(:file) { create :generic_file, read_groups: ["group1"] }
      let(:json) { "{\"id\":\"#{permission.id}\",\"agent\":\"http://projecthydra.org/ns/auth/group#group1\",\"mode\":\"http://www.w3.org/ns/auth/acl#Read\",\"access_to\":\"#{file.id}\"}" }
      it { is_expected.to eq json }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-6.7.0 spec/lib/sufia/export/permission_converter_spec.rb