Sha256: 448fcd37161c1762d80727231bd1c1026b28dc1ffde3dfb015d3e6c27577013b

Contents?: true

Size: 874 Bytes

Versions: 31

Compression:

Stored size: 874 Bytes

Contents

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

31 entries across 31 versions & 1 rubygems

Version Path
blacklight-5.19.2 spec/models/blacklight/document/email_spec.rb
blacklight-5.19.1 spec/models/blacklight/document/email_spec.rb
blacklight-5.19.0 spec/models/blacklight/document/email_spec.rb
blacklight-5.18.0 spec/models/blacklight/document/email_spec.rb
blacklight-5.17.2 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0.pre5 spec/models/blacklight/document/email_spec.rb
blacklight-5.17.1 spec/models/blacklight/document/email_spec.rb
blacklight-5.17.0 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0.pre4 spec/models/blacklight/document/email_spec.rb
blacklight-5.16.4 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0.pre3 spec/models/blacklight/document/email_spec.rb
blacklight-5.16.3 spec/models/blacklight/document/email_spec.rb
blacklight-5.16.2 spec/models/blacklight/document/email_spec.rb
blacklight-5.16.1 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0.pre2 spec/models/blacklight/document/email_spec.rb
blacklight-6.0.0.pre1 spec/models/blacklight/document/email_spec.rb
blacklight-5.16.0 spec/models/blacklight/document/email_spec.rb
blacklight-5.15.0 spec/lib/blacklight/document/email_spec.rb
blacklight-5.14.0 spec/lib/blacklight/document/email_spec.rb
blacklight-5.13.1 spec/lib/blacklight/document/email_spec.rb