Sha256: c252033cd8a5034be5063c56dd2828511492cf95b66f26b82ed34e732c8ac629

Contents?: true

Size: 854 Bytes

Versions: 22

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "Blacklight::Document::Email" do
  before(:all) do
    SolrDocument.use_extension(Blacklight::Document::Email)
  end

  it "onlies return values that are available in the field semantics" do
    doc = SolrDocument.new(id: "1234", title_tsim: "My Title")
    email_body = doc.to_email_text
    expect(email_body).to match(/Title: My Title/)
    expect(email_body).not_to match(/Author/)
  end

  it "handles multi-values fields correctly" do
    doc = SolrDocument.new(id: "1234", title_tsim: ["My Title", "My Alt. Title"])
    email_body = doc.to_email_text
    expect(email_body).to match(/Title: My Title My Alt. Title/)
  end

  it "returns nil if there are no valid field semantics to build the email body from" do
    doc = SolrDocument.new(id: "1234")
    expect(doc.to_email_text).to be_nil
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-7.20.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.20.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.19.2 spec/models/blacklight/document/email_spec.rb
blacklight-7.19.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.19.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.18.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.18.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.17.2 spec/models/blacklight/document/email_spec.rb
blacklight-7.17.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.17.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.16.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.15.2 spec/models/blacklight/document/email_spec.rb
blacklight-7.15.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.15.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.14.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.14.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.13.2 spec/models/blacklight/document/email_spec.rb
blacklight-7.13.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.13.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.12.1 spec/models/blacklight/document/email_spec.rb