Sha256: 246cf571c622a7ff9f1b6c8828275a645eedd748832ea06ff0d9693c62765189

Contents?: true

Size: 904 Bytes

Versions: 7

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe "Blacklight::Document::Email" do
  before(:all) do
    SolrDocument.use_extension( Blacklight::Document::Email )
  end
  it "should only return values that are available in the field semantics" do
    doc = SolrDocument.new({:id=>"1234", :title_display=>"My Title"})
    email_body = doc.to_email_text
    expect(email_body).to match(/Title: My Title/)
    expect(email_body).to_not match(/Author/)
  end
  it "should handle multi-values fields correctly" do
    doc = SolrDocument.new({:id=>"1234", :title_display=>["My Title", "My Alt. Title"]})
    email_body = doc.to_email_text
    expect(email_body).to match(/Title: My Title My Alt. Title/)
  end
  it "should return 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

7 entries across 7 versions & 1 rubygems

Version Path
blacklight-6.3.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.3.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.2.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.1.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.2 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0 spec/models/blacklight/document/email_spec.rb