Sha256: aa9630da01b548dbbbcf7e7095d3323476be2833e3f22aafa84df6464893de4a

Contents?: true

Size: 886 Bytes

Versions: 30

Compression:

Stored size: 886 Bytes

Contents

require 'spec_helper'

describe "Blacklight::Solr::Document::Email" do
  before(:all) do
    SolrDocument.use_extension( Blacklight::Solr::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

30 entries across 30 versions & 1 rubygems

Version Path
blacklight-5.9.4 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.9.3 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.9.2 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.9.1 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.9.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.8.2 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.8.1 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.8.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.7.2 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.5.4 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.7.1 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.7.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.6.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.5.3 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.5.2 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.5.1 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.5.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.4.0 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.4.0.rc1 spec/lib/blacklight/solr/document/email_spec.rb
blacklight-5.3.0 spec/lib/blacklight/solr/document/email_spec.rb