| | 102 | def test_content_for_field_name |
|---|
| | 103 | c = 'lorem ipsum dolor sit amet. lorem.' |
|---|
| | 104 | @c1 = Content.new( :title => 'Content item 1', |
|---|
| | 105 | :description => c ) |
|---|
| | 106 | assert_equal c, @c1.content_for_field_name(:description) |
|---|
| | 107 | end |
|---|
| | 108 | |
|---|
| | 109 | def test_document_number |
|---|
| | 110 | c = 'lorem ipsum dolor sit amet. lorem.' |
|---|
| | 111 | c1 = Content.new( :title => 'Content item 1', |
|---|
| | 112 | :description => c ) |
|---|
| | 113 | c1.save |
|---|
| | 114 | hits = Content.ferret_index.search('title:"Content item 1"') |
|---|
| | 115 | assert_equal 1, hits.total_hits |
|---|
| | 116 | expected_doc_num = hits.hits.first.doc |
|---|
| | 117 | assert_equal c, Content.ferret_index[expected_doc_num][:description] |
|---|
| | 118 | doc_num = c1.document_number |
|---|
| | 119 | assert_equal expected_doc_num, doc_num |
|---|
| | 120 | assert_equal c, Content.ferret_index[doc_num][:description] |
|---|
| | 121 | end |
|---|
| | 122 | |
|---|