fake_arel 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +17 -17
- data/fake_arel.gemspec +1 -1
- data/lib/fake_arel.rb +1 -1
- data/lib/fake_arel/rails_3_finders.rb +2 -1
- data/spec/fake_arel_spec.rb +8 -2
- data/spec/test.db +0 -0
- metadata +14 -29
data/.gemtest
ADDED
File without changes
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
RedCloth (4.2.
|
5
|
-
activerecord (2.3.
|
6
|
-
activesupport (= 2.3.
|
7
|
-
activesupport (2.3.
|
8
|
-
columnize (0.3.
|
9
|
-
hoe (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
|
-
|
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.
|
23
|
-
activesupport (
|
24
|
-
|
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.
|
27
|
-
ruby-debug-base (0.10.
|
26
|
+
ruby-debug-base (~> 0.10.4.0)
|
27
|
+
ruby-debug-base (0.10.4)
|
28
28
|
linecache (>= 0.3)
|
29
|
-
|
30
|
-
|
31
|
-
|
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.
|
38
|
+
activerecord (= 2.3.11)
|
39
39
|
hoe
|
40
40
|
newgem
|
41
41
|
rake
|
data/fake_arel.gemspec
CHANGED
data/lib/fake_arel.rb
CHANGED
@@ -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 }
|
data/spec/fake_arel_spec.rb
CHANGED
@@ -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
|
217
|
+
Reply.order("id desc").fakearel_find_each do |reply|
|
216
218
|
entries << reply
|
217
219
|
end
|
218
220
|
|
219
|
-
entries.
|
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
|
|
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: 53
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
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-
|
18
|
+
date: 2011-04-12 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
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
|
-
|
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:
|
43
|
+
hash: 35
|
44
44
|
segments:
|
45
45
|
- 2
|
46
|
-
-
|
46
|
+
- 9
|
47
47
|
- 4
|
48
|
-
version: 2.
|
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.
|
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"
|