fake_arel 0.9.5 → 0.9.6pre

Sign up to get free protection for your applications and to get access to all the features.
data/fake_arel.gemspec CHANGED
@@ -6,7 +6,7 @@ require 'bundler/version'
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fake_arel"
9
- s.version = "0.9.5"
9
+ s.version = "0.9.6pre"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
@@ -59,7 +59,7 @@ module Rails3Finders
59
59
  end
60
60
  named_scope :or, __or_fn
61
61
 
62
- def self.find_each(options = {:batch_size => 1000}, &block)
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
@@ -9,7 +9,7 @@ require 'fake_arel/rails_3_finders'
9
9
  require 'fake_arel/calculations'
10
10
 
11
11
  module FakeArel
12
- VERSION = '0.9.5'
12
+ VERSION = '0.9.6pre'
13
13
  ActiveRecord::Base.send :include, Rails3Finders
14
14
  ActiveRecord::Base.send :include, WithScopeReplacement
15
15
  end
@@ -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%')").find_each(:batch_size => 5) do |reply|
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: 49
5
- prerelease: false
4
+ hash: 139015340
5
+ prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
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: 3
137
+ hash: 25
138
138
  segments:
139
- - 0
140
- version: "0"
139
+ - 1
140
+ - 3
141
+ - 1
142
+ version: 1.3.1
141
143
  requirements: []
142
144
 
143
145
  rubyforge_project: fake_arel