Sha256: 6902b0f7e7dc628c60d88b19c8043f3af654efa61372c556b2f08f5e513520bf

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 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.id)
      expect(@collection2.reload.members).to eq [@collectible]
      expect(reloaded.collections).to eq [@collection1, @collection2]
    end
  end
  describe "index_collection_ids" do
    it "should add ids for all associated collections" do
      @collectible.save
      @collectible.collections << @collection1
      @collectible.collections << @collection2
      expect(@collectible.index_collection_ids["collection_sim"]).to eq [@collection1.id, @collection2.id]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hydra-collections-4.0.0 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.rc3 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.rc2 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.rc1 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.beta4 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.beta3 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.beta2 spec/lib/collectible_spec.rb
hydra-collections-4.0.0.beta1 spec/lib/collectible_spec.rb
hydra-collections-3.0.0.beta2 spec/lib/collectible_spec.rb
hydra-collections-3.0.0.beta1 spec/lib/collectible_spec.rb