groonga-client-rails 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,15 @@ class PostsSearcherTest < ActionController::TestCase
14
14
  result_set.records.collect {|record| record["body"]})
15
15
  end
16
16
 
17
+ test "should be save tags" do
18
+ create(:post, tags: ["tag1", "tag2"])
19
+ result_set = @searcher.search.result_set
20
+ assert_equal([
21
+ ["tag1", "tag2"],
22
+ ],
23
+ result_set.records.collect {|record| record["tags"]})
24
+ end
25
+
17
26
  test "should be searchable without match_columns" do
18
27
  create(:post, body: "Hello World")
19
28
  create(:post, body: "Hello Rails")
@@ -57,6 +66,23 @@ class PostsSearcherTest < ActionController::TestCase
57
66
  result_set.records.collect {|record| record["body"]})
58
67
  end
59
68
 
69
+ test "should be searchable by an element of array" do
70
+ create(:post, tags: ["tag1", "tag2", "tag3"])
71
+ create(:post, tags: [])
72
+ create(:post, tags: ["tag2"])
73
+ create(:post, tags: ["tag3"])
74
+ result_set = @searcher.
75
+ search.
76
+ filter("tags @ %{tag}", {tag: "tag2"}).
77
+ sortby("_id").
78
+ result_set
79
+ assert_equal([
80
+ ["tag1", "tag2", "tag3"],
81
+ ["tag2"],
82
+ ],
83
+ result_set.records.collect {|record| record["tags"]})
84
+ end
85
+
60
86
  test "should support snippet_html in output_columns" do
61
87
  create(:post, body: "Hello World")
62
88
  create(:post, body: "Hi Rails! Hello!")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga-client-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-07 00:00:00.000000000 Z
11
+ date: 2016-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: groonga-client