Sha256: 84ba3aa8b03f6a3cf62d7aeece0308df9dda48473f0262002dacc771e12fee52

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'test_helper'



class ResultItemTest < ActiveSupport::TestCase
  ResultItem = BentoSearch::ResultItem
  
  def test_has_custom_data
    r = ResultItem.new
    
    assert_not_nil r.custom_data
    assert_kind_of Hash, r.custom_data
  end
  
  def test_can_dup_and_set_attributes
    # Need to be able to dup and set at least basic attributes without
    # changing original. Used by SummonEngine for making sure
    # openurl does not have highlighting tags in it when generated. 
    
    r = ResultItem.new(:title => "original")
    
    assert_equal "original", r.title
    
    dup = r.dup
    dup.title = "new"
    
    assert_equal "new", dup.title
    assert_equal "original", r.title
    
    assert_not_same dup, r
    
    
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bento_search-0.5.0 test/unit/result_item_test.rb
bento_search-0.0.1 test/unit/result_item_test.rb