Sha256: f5ffa8752dc4650a3da63fdb4bd5793d3e2e48c2af1f25eb3ef6bc668ff006bd

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "Blacklight::Document::Email" do
  before(:all) do
    SolrDocument.use_extension( Blacklight::Document::Sms )
  end
  it "should only return values that are available in the field semantics" do
    doc = SolrDocument.new({:id=>"1234", :title_tsim=>"My Title", :author_tsim=>"Joe Schmoe"})
    sms_text = doc.to_sms_text
    expect(sms_text).to match(/My Title by Joe Schmoe/)
  end
  it "should handle multi-values fields correctly and only take the first" do
    doc = SolrDocument.new({:id=>"1234", :title_tsim=>["My Title", "My Alt. Title"]})
    sms_text = doc.to_sms_text
    expect(sms_text).to match(/My Title/)
    expect(sms_text).to_not match(/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_sms_text).to be_nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-7.0.0.rc1 spec/models/blacklight/document/sms_spec.rb