Sha256: 68c5054af26d887f85ad2f6d81421d7dc9f29a54eea28d0a2925e2981f363c77

Contents?: true

Size: 1.16 KB

Versions: 18

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

RSpec.describe Item, type: :model do

  it_behaves_like "a DDR model"
  it_behaves_like "it has an association", :belongs_to, :parent, :is_member_of_collection, "Collection"
  it_behaves_like "it has an association", :has_many, :children, :is_part_of, "Component"
  it_behaves_like "a non-collection model"
  it_behaves_like "a potentially publishable object"

  describe "indexing text" do
    let(:children) { FactoryGirl.build_list(:component, 5) }

    let(:text1) { fixture_file_upload('extractedText1.txt', 'text/plain') }
    let(:text2) { fixture_file_upload('extractedText2.txt', 'text/plain') }
    let(:text3) { fixture_file_upload('extractedText3.txt', 'text/plain') }

    before {
      children[0].extractedText.content = text1
      children[0].save
      children[1].extractedText.content = text2
      children[1].save
      children[2].extractedText.content = text3
      children[2].save
      subject.children = children
      subject.save
    }

    it "indexes the combined text of its children" do
      expect(subject.index_fields[Ddr::Index::Fields::ALL_TEXT]).to contain_exactly(text1.read, text2.read, text3.read)
    end
  end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ddr-models-2.6.2 spec/models/item_spec.rb
ddr-models-2.6.1 spec/models/item_spec.rb
ddr-models-2.6.0 spec/models/item_spec.rb
ddr-models-2.6.0.rc4 spec/models/item_spec.rb
ddr-models-2.6.0.rc3 spec/models/item_spec.rb
ddr-models-2.6.0.rc2 spec/models/item_spec.rb
ddr-models-2.6.0.rc1 spec/models/item_spec.rb
ddr-models-2.5.3 spec/models/item_spec.rb
ddr-models-2.5.2 spec/models/item_spec.rb
ddr-models-2.5.1 spec/models/item_spec.rb
ddr-models-2.5.0 spec/models/item_spec.rb
ddr-models-2.5.0.rc1 spec/models/item_spec.rb
ddr-models-2.4.16 spec/models/item_spec.rb
ddr-models-2.4.15 spec/models/item_spec.rb
ddr-models-2.4.14 spec/models/item_spec.rb
ddr-models-2.4.13 spec/models/item_spec.rb
ddr-models-2.4.12 spec/models/item_spec.rb
ddr-models-2.4.11 spec/models/item_spec.rb