Sha256: 3100107bb9a64089c586914fae7e3de2883a25d0e139814588c9647191e89c6d
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require_relative '../../../test_helper' class ArticleTest < ActiveSupport::TestCase fixtures :articles setup do Article.reindex! end test "Full text search" do results = Article.search do fulltext 'weather' end assert results.length == 1, 'The number of result is wrong, should be one' assert results[0][:title] == 'Weather report', 'The returned title is wrong' end test "Ascending order" do results = Article.search do order_by :category_id, :asc end cat_id = nil results.each do |article| assert(cat_id <= article[:category_id], 'Order is wrong') unless cat_id.nil? cat_id = article[:category_id] end end test "Descending order" do results = Article.search do order_by :category_id, :desc end cat_id = nil results.each do |article| assert(cat_id >= article[:category_id], 'Order is wrong') unless cat_id.nil? cat_id = article[:category_id] end end test "Deletion" do results = Article.search do fulltext 'weather' end results[0].destroy end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oss_active_record-0.3.1 | test/dummy/test/models/article_test.rb |