Sha256: fea842970ac20ef9f2f914600009dbf055a2822a4c6b6e17509cc2d3cae1a7fd

Contents?: true

Size: 882 Bytes

Versions: 36

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

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

36 entries across 36 versions & 1 rubygems

Version Path
blacklight-6.25.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.24.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.23.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.22.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.21.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.20.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.19.2 spec/models/blacklight/document/email_spec.rb
blacklight-6.19.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.19.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.18.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.17.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.16.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.15.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.14.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.14.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.13.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.12.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.11.2 spec/models/blacklight/document/email_spec.rb
blacklight-6.11.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.11.0 spec/models/blacklight/document/email_spec.rb