friendly 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/friendly.gemspec +1 -1
- data/lib/friendly/indexer.rb +1 -1
- data/spec/integration/offline_indexing_spec.rb +22 -6
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.1
|
data/friendly.gemspec
CHANGED
data/lib/friendly/indexer.rb
CHANGED
@@ -22,16 +22,32 @@ describe "Building an index offline" do
|
|
22
22
|
|
23
23
|
@klass.indexes :name
|
24
24
|
@klass.create_tables!
|
25
|
-
Friendly::Indexer.populate(@klass, :name)
|
26
25
|
end
|
27
26
|
|
28
|
-
|
29
|
-
|
27
|
+
describe "" do
|
28
|
+
before do
|
29
|
+
Friendly::Indexer.populate(@klass, :name)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "builds the missing index rows for all the rows in the doc table" do
|
33
|
+
@klass.all(:name => "James").should == @jameses
|
34
|
+
end
|
35
|
+
|
36
|
+
it "ignores records that are already in the index" do
|
37
|
+
lambda {
|
38
|
+
Friendly::Indexer.populate(@klass, :name)
|
39
|
+
}.should_not raise_error
|
40
|
+
end
|
30
41
|
end
|
31
42
|
|
32
|
-
|
33
|
-
|
43
|
+
describe "with more than `Indexer.objects_per_iteration` objects" do
|
44
|
+
before do
|
45
|
+
Friendly::Indexer.objects_per_iteration = 1
|
34
46
|
Friendly::Indexer.populate(@klass, :name)
|
35
|
-
|
47
|
+
end
|
48
|
+
|
49
|
+
it "builds the missing index rows for all the rows in the doc table" do
|
50
|
+
@klass.all(:name => "James").should == @jameses
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|