| | 46 | |
|---|
| | 47 | highlight = @another_content.highlight('title', :field => :description) |
|---|
| | 48 | assert_equal 1, highlight.size |
|---|
| | 49 | assert_equal "this is not the <em>title</em>", highlight.first |
|---|
| | 50 | end |
|---|
| | 51 | |
|---|
| | 52 | def test_highlight_new_record |
|---|
| | 53 | c = Content.create :title => 'the title', :description => 'the new description' |
|---|
| | 54 | highlight = c.highlight('new') |
|---|
| | 55 | assert_equal 1, highlight.size |
|---|
| | 56 | assert_equal "the <em>new</em> description", highlight.first |
|---|
| | 57 | |
|---|
| | 58 | c1 = Content.find_by_contents('new description').first |
|---|
| | 59 | assert_equal c, c1 |
|---|
| | 60 | highlight = c1.highlight('new') |
|---|
| | 61 | assert_equal 1, highlight.size |
|---|
| | 62 | assert_equal "the <em>new</em> description", highlight.first |
|---|