friendly 0.5.0 → 0.5.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 CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{friendly}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Golick"]
@@ -22,8 +22,8 @@ module Friendly
22
22
  end
23
23
 
24
24
  def populate(klass, index)
25
+ count = 0
25
26
  loop do
26
- count = 0
27
27
  rows = datastore.all(klass, Query.new(:offset! => count,
28
28
  :limit! => objects_per_iteration,
29
29
  :order! => :added_id.asc))
@@ -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
- it "builds the missing index rows for all the rows in the doc table" do
29
- @klass.all(:name => "James").should == @jameses
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
- it "ignores records that are already in the index" do
33
- lambda {
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
- }.should_not raise_error
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: friendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Golick