Sha256: 3145805109f686b5e3632d6cf2c25eb00ac4cb0ac692aa9ee40c15409b803839

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe FeaturedWorkList, :type => :model do
  let(:file1) { FactoryGirl.create(:generic_file) }
  let(:file2) { FactoryGirl.create(:generic_file) }

  before do
    FeaturedWork.create(generic_file_id: file1.noid)
    FeaturedWork.create(generic_file_id: file2.noid)
  end

  describe 'featured_works' do
    it 'should be a list of the featured work objects, each with the generic_file\'s solr_doc' do
      expect(subject.featured_works.size).to eq 2
      solr_doc = subject.featured_works.first.generic_file_solr_document
      expect(solr_doc).to be_kind_of SolrDocument
      expect(solr_doc.noid).to eq file1.noid
    end
  end

  describe 'file deleted' do
    before do
      file1.destroy
    end
    it 'should be a list of the remaining featured work objects, each with the generic_file\'s solr_doc' do
      expect(subject.featured_works.size).to eq 1
      solr_doc = subject.featured_works.first.generic_file_solr_document
      expect(solr_doc).to be_kind_of SolrDocument
      expect(solr_doc.noid).to eq file2.noid
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-6.0.0.rc2 spec/models/featured_work_list_spec.rb
sufia-6.0.0.rc1 spec/models/featured_work_list_spec.rb
sufia-6.0.0.beta1 spec/models/featured_work_list_spec.rb