Sha256: be43e9e377d517415a5d75d2ece0e16e40a3c2154f3ebb941b7287ea6e35a1fa

Contents?: true

Size: 852 Bytes

Versions: 18

Compression:

Stored size: 852 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

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-7.10.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.9.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.8.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.8.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.7.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.6.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.5.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.5.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.4.2 spec/models/blacklight/document/email_spec.rb
blacklight-7.4.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.4.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.3.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.2.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.1.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.1.0.alpha spec/models/blacklight/document/email_spec.rb
blacklight-7.0.1 spec/models/blacklight/document/email_spec.rb
blacklight-7.0.0 spec/models/blacklight/document/email_spec.rb
blacklight-7.0.0.rc2 spec/models/blacklight/document/email_spec.rb