Sha256: cf3a2f48743f4a092ffc347d9306bd9101e38868e1390833c1f6d0c3093532af

Contents?: true

Size: 948 Bytes

Versions: 5

Compression:

Stored size: 948 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Blacklight::Solr::Document::Email" do
  before(:all) do
    SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
  end
  it "should only return values that are available in the field semantics" do
    doc = SolrDocument.new({:id=>"1234", :title_display=>"My Title", :author_display=>"Joe Schmoe"})
    sms_text = doc.to_sms_text
    sms_text.should 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_display=>["My Title", "My Alt. Title"]})
    sms_text = doc.to_sms_text
    sms_text.should match(/My Title/)
    sms_text.should_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"})
    doc.to_sms_text.should be_nil
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-3.0.0pre6 test_support/spec/lib/blacklight_sms_spec.rb
blacklight-3.0.0pre4 test_support/spec/lib/blacklight_sms_spec.rb
blacklight-3.0.0pre3 test_support/spec/lib/blacklight_sms_spec.rb
blacklight-3.0pre2 test_support/spec/lib/blacklight_sms_spec.rb
blacklight-3.0pre1 test_app/spec/lib/blacklight_sms_spec.rb