Sha256: 06905bdf9ef0c41adcca771b76ef63cab47148b1d42c6d4892987c99a36497e4

Contents?: true

Size: 1.05 KB

Versions: 11

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"
class CollectibleThing < ActiveFedora::Base
  include Hydra::Collections::Collectible
end

describe Hydra::Collections::Collectible do
  before do
    @collection1 = FactoryGirl.create(:collection)
    @collection2 = FactoryGirl.create(:collection)
    @collectible = CollectibleThing.new
  end
  describe "collections associations" do
    it "should allow adding and removing" do
      @collectible.save
      @collection1.members << @collectible
      @collection1.save
      @collectible.collections << @collection2
      reloaded = CollectibleThing.find(@collectible.pid)
      @collection2.reload.members.should == [@collectible]
      reloaded.collections.should == [@collection1, @collection2]
    end
  end
  describe "index_collection_pids" do
    it "should add pids for all associated collections" do
      @collectible.save
      @collectible.collections << @collection1
      @collectible.collections << @collection2
      @collectible.index_collection_pids["collection_sim"].should == [@collection1.pid, @collection2.pid]
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hydra-collections-2.0.3 spec/lib/collectible_spec.rb
hydra-collections-2.0.2 spec/lib/collectible_spec.rb
hydra-collections-2.0.1 spec/lib/collectible_spec.rb
hydra-collections-2.0.0 spec/lib/collectible_spec.rb
hydra-collections-1.3.2 spec/lib/collectible_spec.rb
hydra-collections-1.3.1 spec/lib/collectible_spec.rb
hydra-collections-1.3.0 spec/lib/collectible_spec.rb
hydra-collections-1.2.0 spec/lib/collectible_spec.rb
hydra-collections-1.2.0.rc1 spec/lib/collectible_spec.rb
hydra-collections-1.1.0 spec/lib/collectible_spec.rb
hydra-collections-1.0.0 spec/lib/collectible_spec.rb