Sha256: 935fabc5f59f067842a195a42fb765c70f30b2bc2221c4df9e17df2a84f89c33

Contents?: true

Size: 815 Bytes

Versions: 13

Compression:

Stored size: 815 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'
require 'pp'
require 'fileutils'

class FerretResultTest < Test::Unit::TestCase
  fixtures :contents

  def teardown
  end
  
  def test_get_prefetched_fields_from_hash
    fr = ActsAsFerret::FerretResult.new 'Content', '1', 0.5, 1, :description => 'description from ferret index'
    assert_equal 'description from ferret index', fr.description
    assert_equal 0.5, fr.ferret_score
    assert_equal 1, fr.ferret_rank
    assert_equal 'My Title', fr.title # triggers auto-load of the record
    assert_equal 'A useless description', fr.description # description now comes from DB
  end

  def test_to_param
    fr = ActsAsFerret::FerretResult.new 'Content', '1', 0.5, 1, :description => 'description from ferret index'
    assert_equal '1', fr.to_param
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
cehoffman-acts_as_ferret-0.4.4 doc/demo/test/unit/ferret_result_test.rb
jkraemer-acts_as_ferret-0.4.4 doc/demo/test/unit/ferret_result_test.rb
watson-acts_as_ferret-0.4.8.2 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.5.2 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.8.2 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.8.1 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.5.1 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.5 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.8.rails3 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.8 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.7 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.6 doc/demo/test/unit/ferret_result_test.rb
acts_as_ferret-0.4.4 doc/demo/test/unit/ferret_result_test.rb