Skip to content
Newer
Older
100644 40 lines (30 sloc) 1.05 KB
fc45bb0 @karmi Added basic wrapper class for _hits_ in results, so we could write `r…
authored
1 require 'test_helper'
2
19e570b @karmi [GEM] Updated gem name to "tire" and renamed all files from "slingsho…
authored
3 module Tire
fc45bb0 @karmi Added basic wrapper class for _hits_ in results, so we could write `r…
authored
4
5 class ResultsIntegrationTest < Test::Unit::TestCase
6 include Test::Integration
7
8 context "Query results" do
9
10 should "allow easy access to returned documents" do
11 q = 'title:one'
19e570b @karmi [GEM] Updated gem name to "tire" and renamed all files from "slingsho…
authored
12 s = Tire.search('articles-test') { query { string q } }
fc45bb0 @karmi Added basic wrapper class for _hits_ in results, so we could write `r…
authored
13 assert_equal 'One', s.results.first.title
14 assert_equal 'ruby', s.results.first.tags[0]
15 end
16
17 should "allow easy access to returned documents with limited fields" do
18 q = 'title:one'
19e570b @karmi [GEM] Updated gem name to "tire" and renamed all files from "slingsho…
authored
19 s = Tire.search('articles-test') { query { string q }.fields :title }
fc45bb0 @karmi Added basic wrapper class for _hits_ in results, so we could write `r…
authored
20 assert_equal 'One', s.results.first.title
21 assert_nil s.results.first.tags
22 end
23
70b30ed @karmi Changed the Search#fields method to accept arguments as a splat or an…
authored
24 should "allow to retrieve multiple fields" do
25 q = 'title:one'
26 s = Tire.search('articles-test') do
27 query { string q }
28 fields 'title', 'tags'
29 end
30 assert_equal 'One', s.results.first.title
31 assert_equal 'ruby', s.results.first.tags[0]
32 assert_nil s.results.first.published_on
33 end
34
fc45bb0 @karmi Added basic wrapper class for _hits_ in results, so we could write `r…
authored
35 end
36
37 end
38
39 end
Something went wrong with that request. Please try again.