Sha256: 8115f32ff867becdce80c64724eab5a46fcabf31a8d14ec8c3f604c482a621c8

Contents?: true

Size: 1.94 KB

Versions: 17

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'

describe Hydra::Datastream::RightsMetadata do
  before :all do
    class RightsTest < ActiveFedora::Base
      include Hydra::AccessControls::Permissions
    end
  end

  after :all do
    Object.send(:remove_const,:RightsTest)
  end

  describe "rightsMetadata" do
    let!(:thing) {RightsTest.new}

    [:discover,:read, :edit].each do |mode|
      describe "##{mode}_users" do
        let(:get_method) {"#{mode}_users".to_sym}
        let(:set_method) {"#{mode}_users=".to_sym}

        before :each do
          thing.send(set_method, ['locutus@borg.collective.mil'])
          thing.save
        end

        it "should persist initial setting" do
          thing.reload.send(get_method).should == ['locutus@borg.collective.mil']
        end

        it "should persist changes" do
          thing.send(set_method, ['locutus@borg.collective.mil','sevenofnine@borg.collective.mil'])
          thing.save
          thing.reload.send(get_method).should =~ ['locutus@borg.collective.mil','sevenofnine@borg.collective.mil']
        end

        it "should persist emptiness" do
          thing.send(set_method, [])
          thing.save
          thing.reload.send(get_method).should == []
        end
      end

      describe "##{mode}_groups" do
        let(:get_method) {"#{mode}_groups".to_sym}
        let(:set_method) {"#{mode}_groups=".to_sym}

        before :each do
          thing.send(set_method, ['borg'])
          thing.save
        end

        it "should persist initial setting" do
          thing.reload.send(get_method).should == ['borg']
        end

        it "should persist changes" do
          thing.send(set_method, ['borg','federation'])
          thing.save
          thing.reload.send(get_method).should =~ ['borg','federation']
        end

        it "should persist emptiness" do
          thing.send(set_method, [])
          thing.save
          thing.reload.send(get_method).should == []
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hydra-access-controls-8.2.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-8.1.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-8.0.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-8.0.0.beta1 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.2.2 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.2.1 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.2.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.1.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.1.0.rc2 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.1.0.rc1 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.2 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.1 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.0 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.0.rc1 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.0.pre3 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.0.pre2 spec/unit/hydra_rights_metadata_persistence_spec.rb
hydra-access-controls-7.0.0.pre1 spec/unit/hydra_rights_metadata_persistence_spec.rb