Sha256: ed9558b7987ef18559b67431f26a90adde1acc412fa06f05336579063564dafe

Contents?: true

Size: 944 Bytes

Versions: 49

Compression:

Stored size: 944 Bytes

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../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
    email_body.should match(/Title: My Title/)
    email_body.should_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
    email_body.should 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"})
    doc.to_email_text.should be_nil
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
blacklight-4.0.0.rc2 test_support/spec/lib/blacklight_email_spec.rb
blacklight-4.0.0.rc1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-4.0.0.pre7 test_support/spec/lib/blacklight_email_spec.rb
blacklight-4.0.0.pre6 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.8.1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.8.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.7.2 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.7.1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.7.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.6.1.1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.6.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.5.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.4.2 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.4.1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.4.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.3.2 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.3.1 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.3.0 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.2.2 test_support/spec/lib/blacklight_email_spec.rb
blacklight-3.2.1 test_support/spec/lib/blacklight_email_spec.rb