fake_arel 0.9.6 → 0.9.7

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.
File without changes
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # A sample Gemfile
2
2
  source "http://rubygems.org"
3
3
 
4
- gem "activerecord", "2.3.5"
4
+ gem "activerecord", "2.3.11"
5
5
 
6
6
  group :development do
7
7
  gem 'rspec', '1.3.1'
@@ -1,15 +1,14 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- RedCloth (4.2.3)
5
- activerecord (2.3.5)
6
- activesupport (= 2.3.5)
7
- activesupport (2.3.5)
8
- columnize (0.3.1)
9
- hoe (2.6.2)
4
+ RedCloth (4.2.7)
5
+ activerecord (2.3.11)
6
+ activesupport (= 2.3.11)
7
+ activesupport (2.3.11)
8
+ columnize (0.3.2)
9
+ hoe (2.9.4)
10
10
  rake (>= 0.8.7)
11
- rubyforge (>= 2.0.4)
12
- json_pure (1.4.6)
11
+ i18n (0.5.0)
13
12
  linecache (0.43)
14
13
  newgem (1.5.3)
15
14
  RedCloth (>= 4.1.1)
@@ -19,23 +18,24 @@ GEM
19
18
  syntax (>= 1.0.0)
20
19
  rake (0.8.7)
21
20
  rspec (1.3.1)
22
- rubigen (1.5.5)
23
- activesupport (~> 2.3.5)
24
- ruby-debug (0.10.3)
21
+ rubigen (1.5.6)
22
+ activesupport (>= 2.3.5)
23
+ i18n
24
+ ruby-debug (0.10.4)
25
25
  columnize (>= 0.1)
26
- ruby-debug-base (~> 0.10.3.0)
27
- ruby-debug-base (0.10.3)
26
+ ruby-debug-base (~> 0.10.4.0)
27
+ ruby-debug-base (0.10.4)
28
28
  linecache (>= 0.3)
29
- rubyforge (2.0.4)
30
- json_pure (>= 1.1.7)
31
- sqlite3-ruby (1.3.1)
29
+ sqlite3 (1.3.3)
30
+ sqlite3-ruby (1.3.3)
31
+ sqlite3 (>= 1.3.3)
32
32
  syntax (1.0.0)
33
33
 
34
34
  PLATFORMS
35
35
  ruby
36
36
 
37
37
  DEPENDENCIES
38
- activerecord (= 2.3.5)
38
+ activerecord (= 2.3.11)
39
39
  hoe
40
40
  newgem
41
41
  rake
@@ -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.6"
9
+ s.version = "0.9.7"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.author = "Grant Ammons"
12
12
  s.email = ["grant@pipelinedealsco.com"]
@@ -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.6'
12
+ VERSION = '0.9.7'
13
13
  ActiveRecord::Base.send :include, Rails3Finders
14
14
  ActiveRecord::Base.send :include, WithScopeReplacement
15
15
  end
@@ -60,7 +60,8 @@ module Rails3Finders
60
60
  named_scope :or, __or_fn
61
61
 
62
62
  def self.fakearel_find_each(options = {:batch_size => 1000}, &block)
63
- count = self.scoped.count
63
+ count = self.scoped({}).count
64
+ return self.scoped({}) if count <= options[:batch_size]
64
65
  offset = 0
65
66
  while offset < count
66
67
  self.scoped(:limit => options[:batch_size], :offset => offset).each { |entry| yield entry }
@@ -205,18 +205,24 @@ describe "Fake Arel" do
205
205
  Reply.order("id desc").fakearel_find_each(:batch_size => 5) do |reply|
206
206
  entries << reply
207
207
  end
208
+
208
209
  entries.map(&:id).each_with_index do |e,i|
209
210
  if i < entries.size
210
211
  e.should be > e[i+1]
211
212
  end
212
213
  end
213
214
 
215
+ # test jumping out and not batching
214
216
  entries = []
215
- Reply.order("id desc").fakearel_find_each(:batch_size => 500) do |reply|
217
+ Reply.order("id desc").fakearel_find_each do |reply|
216
218
  entries << reply
217
219
  end
218
220
 
219
- entries.size.should == Reply.count
221
+ entries.map(&:id).each_with_index do |e,i|
222
+ if i < entries.size
223
+ e.should be > e[i+1]
224
+ end
225
+ end
220
226
  end
221
227
  end
222
228
 
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: 55
5
- prerelease: false
4
+ hash: 53
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 6
10
- version: 0.9.6
9
+ - 7
10
+ version: 0.9.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Grant Ammons
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-22 00:00:00 -04:00
18
+ date: 2011-04-12 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ">="
@@ -31,41 +31,25 @@ dependencies:
31
31
  - 5
32
32
  version: 2.3.5
33
33
  type: :runtime
34
+ requirement: *id001
34
35
  name: activerecord
35
36
  prerelease: false
36
- version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- hash: 7
43
+ hash: 35
44
44
  segments:
45
45
  - 2
46
- - 0
46
+ - 9
47
47
  - 4
48
- version: 2.0.4
49
- type: :development
50
- name: rubyforge
51
- prerelease: false
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 19
60
- segments:
61
- - 2
62
- - 6
63
- - 2
64
- version: 2.6.2
48
+ version: 2.9.4
65
49
  type: :development
50
+ requirement: *id002
66
51
  name: hoe
67
52
  prerelease: false
68
- version_requirements: *id003
69
53
  description: |-
70
54
  * Tired of waiting for Rails 3 and its new super-sweet query interface? Try fake_arel!
71
55
 
@@ -110,6 +94,7 @@ files:
110
94
  - spec/spec_helper.rb
111
95
  - spec/test.db
112
96
  - tasks/rspec.rake
97
+ - .gemtest
113
98
  has_rdoc: true
114
99
  homepage: http://github.com/gammons/fake_arel
115
100
  licenses: []
@@ -141,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
126
  requirements: []
142
127
 
143
128
  rubyforge_project: fake_arel
144
- rubygems_version: 1.3.7
129
+ rubygems_version: 1.4.2
145
130
  signing_key:
146
131
  specification_version: 3
147
132
  summary: "* Tired of waiting for Rails 3 and its new super-sweet query interface? Try fake_arel! * Fake_arel is a gem that will simulate the new Rails 3 query interface, using named_scopes and a couple small patches to ActiveRecord"