fake_arel 0.9.5 → 0.9.6pre
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/fake_arel.gemspec +1 -1
- data/lib/fake_arel/rails_3_finders.rb +1 -1
- data/lib/fake_arel.rb +1 -1
- data/spec/fake_arel_spec.rb +11 -1
- data/spec/test.db +0 -0
- metadata +10 -8
data/fake_arel.gemspec
CHANGED
|
@@ -59,7 +59,7 @@ module Rails3Finders
|
|
|
59
59
|
end
|
|
60
60
|
named_scope :or, __or_fn
|
|
61
61
|
|
|
62
|
-
def self.
|
|
62
|
+
def self.fakearel_find_each(options = {:batch_size => 1000}, &block)
|
|
63
63
|
count = self.scoped.count
|
|
64
64
|
return self.scoped if count <= options[:batch_size]
|
|
65
65
|
offset = 0
|
data/lib/fake_arel.rb
CHANGED
data/spec/fake_arel_spec.rb
CHANGED
|
@@ -193,13 +193,23 @@ describe "Fake Arel" do
|
|
|
193
193
|
|
|
194
194
|
count = 0
|
|
195
195
|
entries = []
|
|
196
|
-
Reply.where("content LIKE('This is reply number%')").
|
|
196
|
+
Reply.where("content LIKE('This is reply number%')").fakearel_find_each(:batch_size => 5) do |reply|
|
|
197
197
|
count += 1
|
|
198
198
|
reply.class.should == Reply
|
|
199
199
|
entries << reply
|
|
200
200
|
end
|
|
201
201
|
count.should == 10
|
|
202
202
|
entries.should == Reply.where("content LIKE('This is reply number%')")
|
|
203
|
+
|
|
204
|
+
entries = []
|
|
205
|
+
Reply.order("id desc").fakearel_find_each(:batch_size => 5) do |reply|
|
|
206
|
+
entries << reply
|
|
207
|
+
end
|
|
208
|
+
entries.map(&:id).each_with_index do |e,i|
|
|
209
|
+
if i < entries.size
|
|
210
|
+
e.should be > e[i+1]
|
|
211
|
+
end
|
|
212
|
+
end
|
|
203
213
|
end
|
|
204
214
|
end
|
|
205
215
|
|
data/spec/test.db
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fake_arel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 139015340
|
|
5
|
+
prerelease: true
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
|
-
-
|
|
10
|
-
version: 0.9.
|
|
9
|
+
- 6pre
|
|
10
|
+
version: 0.9.6pre
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Grant Ammons
|
|
@@ -132,12 +132,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
none: false
|
|
134
134
|
requirements:
|
|
135
|
-
- - "
|
|
135
|
+
- - ">"
|
|
136
136
|
- !ruby/object:Gem::Version
|
|
137
|
-
hash:
|
|
137
|
+
hash: 25
|
|
138
138
|
segments:
|
|
139
|
-
-
|
|
140
|
-
|
|
139
|
+
- 1
|
|
140
|
+
- 3
|
|
141
|
+
- 1
|
|
142
|
+
version: 1.3.1
|
|
141
143
|
requirements: []
|
|
142
144
|
|
|
143
145
|
rubyforge_project: fake_arel
|