scientist-softserv / adventist_knapsack

Apache License 2.0
1 stars 0 forks source link

🧹 Remove collection_spec #40

Closed jeremyf closed 9 months ago

jeremyf commented 9 months ago

In reviewing spec/models/collection_spec.rb and hyrax-webapp/spec/models/collection_spec.rb; the specs in the Knapsack are a subset of the specs in the collection_spec.rb

diff between knapsack and Hyku ``` ❯ diff spec/models/collection_spec.rb hyrax-webapp/spec/models/collection_spec.rb 5a6,13 > let(:user) { create(:user).tap { |u| u.add_role(:admin, Site.instance) } } > let(:account) { create(:account) } > let(:collection) { create(:collection, user: user) } > > before do > Site.update(account: account) > end > 14a23,73 > > describe "Featured Collections" do > before do > FeaturedCollection.create(collection_id: collection.id) > end > > describe "#update" do > context "when collection is public" do > let(:collection) { create(:public_collection) } > > it "does not remove the collection from featured collections" do > expect(collection).not_to receive(:remove_featured) > collection.update(title: ['New collection title']) > end > end > > context "when collection is private" do > let(:collection) { create(:private_collection) } > > it "removes collection from featured collections" do > expect(collection).to receive(:remove_featured) > collection.update(title: ['New collection title']) > end > end > > context "when collection is changed from public to private" do > let(:collection) { create(:public_collection) } > > it "removes collection from featured collections" do > expect(collection).to receive(:remove_featured) > collection.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE > collection.save! > end > end > end > > describe "#destroy" do > it 'deletes the featured collection after destroying the collection' do > expect(collection).to receive(:remove_featured) > collection.destroy > end > end > > describe "#remove_featured" do > it 'removes collection from featured collections' do > expect(FeaturedCollection.where(collection_id: collection.id).count).to eq(1) > collection.remove_featured > expect(FeaturedCollection.where(collection_id: collection.id).count).to eq(0) > end > end > end ```

Related to: