|
Revision 313, 0.8 kB
(checked in by jk, 8 months ago)
|
to_param test for ferret_result, partial test
|
| Line | |
|---|
| 1 |
require File.dirname(__FILE__) + '/../test_helper' |
|---|
| 2 |
require 'pp' |
|---|
| 3 |
require 'fileutils' |
|---|
| 4 |
|
|---|
| 5 |
class FerretResultTest < Test::Unit::TestCase |
|---|
| 6 |
fixtures :contents |
|---|
| 7 |
|
|---|
| 8 |
def teardown |
|---|
| 9 |
end |
|---|
| 10 |
|
|---|
| 11 |
def test_get_prefetched_fields_from_hash |
|---|
| 12 |
fr = ActsAsFerret::FerretResult.new 'Content', '1', 0.5, 1, :description => 'description from ferret index' |
|---|
| 13 |
assert_equal 'description from ferret index', fr.description |
|---|
| 14 |
assert_equal 0.5, fr.ferret_score |
|---|
| 15 |
assert_equal 1, fr.ferret_rank |
|---|
| 16 |
assert_equal 'My Title', fr.title # triggers auto-load of the record |
|---|
| 17 |
assert_equal 'A useless description', fr.description # description now comes from DB |
|---|
| 18 |
end |
|---|
| 19 |
|
|---|
| 20 |
def test_to_param |
|---|
| 21 |
fr = ActsAsFerret::FerretResult.new 'Content', '1', 0.5, 1, :description => 'description from ferret index' |
|---|
| 22 |
assert_equal '1', fr.to_param |
|---|
| 23 |
end |
|---|
| 24 |
end |
|---|