lunar 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/lunar/search.rb +3 -0
- data/lunar.gemspec +1 -1
- data/test/test_lunar_search.rb +24 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/lunar/search.rb
CHANGED
data/lunar.gemspec
CHANGED
data/test/test_lunar_search.rb
CHANGED
@@ -7,6 +7,30 @@ class Item < Struct.new(:id)
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class LunarSearchTest < Test::Unit::TestCase
|
10
|
+
context "searching when there exists no index yet" do
|
11
|
+
should "return an empty set" do
|
12
|
+
items = Lunar.search(Item, "foobar")
|
13
|
+
|
14
|
+
assert_equal 0, items.size
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when searching a non existent term, with an index existing" do
|
19
|
+
setup do
|
20
|
+
Lunar::Index.create "Item" do |i|
|
21
|
+
i.key 1001
|
22
|
+
i.attr :name, 'iphone 3GS'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
should "still return an empty set" do
|
27
|
+
items = Lunar.search(Item, "foobar")
|
28
|
+
|
29
|
+
assert_equal 0, items.size
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
10
34
|
context "given an Item named iphone 3GS and apple macbook pro 17 exists" do
|
11
35
|
setup do
|
12
36
|
Lunar::Index.create "Item" do |i|
|