Sha256: cb410c24df5fd966c6a719265a2114cd2fb74f9c4fd0eacf606270d976cc8cd7

Contents?: true

Size: 899 Bytes

Versions: 3

Compression:

Stored size: 899 Bytes

Contents

require 'test_helper'



class ResultItemDisplayTest < ActiveSupport::TestCase
  Author = BentoSearch::Author
  ResultItem = BentoSearch::ResultItem
  
  test "author with first and last" do
    author = Author.new(:last => "Smith", :first => "John")
    
    str = ResultItem.new.author_display(author)
    
    assert_equal "Smith, J", str    
  end
  
  test "author with display form and just last" do
    author = Author.new(:last => "Smith", :display => "Display Form")
    
    str = ResultItem.new.author_display(author)
    
    assert_equal "Display Form", str
  end
  
  test "Author with just last" do
    author = Author.new(:last => "Johnson")
    
    str = ResultItem.new.author_display(author)
    
    assert_equal "Johnson", str
    
  end
  
  test "Missing title" do
    assert_equal I18n.translate("bento_search.missing_title"), ResultItem.new.complete_title
  end
    
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bento_search-0.6.0 test/unit/result_item_display_test.rb
bento_search-0.5.0 test/unit/result_item_display_test.rb
bento_search-0.0.1 test/unit/result_item_display_test.rb