activerecord-simpledb-adapter 0.4.11 → 0.4.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +4 -0
- data/Gemfile +7 -8
- data/Gemfile.lock +58 -70
- data/Rakefile +23 -0
- data/VERSION +1 -0
- data/activerecord-simpledb-adapter.gemspec +20 -79
- data/lib/active_record/connection_adapters/simpledb_adapter/defaults.rb +1 -1
- data/lib/activerecord-simpledb-adapter.rb +5 -15
- data/lib/railtie.rb +16 -0
- data/spec/active_record/associations_spec.rb +32 -0
- data/spec/active_record/batch_spec.rb +91 -0
- data/spec/active_record/connection_adapters/simpledb_adapter_spec.rb +28 -0
- data/spec/active_record/core_actions_spec.rb +47 -0
- data/spec/active_record/defaults_spec.rb +36 -0
- data/spec/active_record/json_spec.rb +30 -0
- data/spec/active_record/locking_spec.rb +50 -0
- data/spec/active_record/offset_spec.rb +24 -0
- data/spec/active_record/record_attributes_spec.rb +111 -0
- data/spec/active_record/types_spec.rb +30 -0
- data/spec/active_record/validates_spec.rb +36 -0
- data/spec/active_record/where_spec.rb +27 -0
- data/spec/assets/db/seeds.rb +1 -0
- data/spec/generators/model_spec.rb +17 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/tasks/rake_spec.rb +134 -0
- metadata +257 -195
data/.rspec
ADDED
data/Gemfile
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem 'aws'
|
4
|
-
gem '
|
5
|
-
gem '
|
3
|
+
gem 'aws'
|
4
|
+
gem 'rake'
|
5
|
+
gem 'activerecord', '~> 3.0.9'
|
6
|
+
gem 'uuidtools'
|
6
7
|
|
7
8
|
group :development do
|
8
9
|
gem 'awesome_print'
|
9
|
-
gem 'rspec'
|
10
|
-
gem 'jeweler'
|
11
|
-
gem 'rcov', '>= 0'
|
12
|
-
gem 'genspec', '0.2.0.prerails3.2'
|
10
|
+
gem 'rspec'
|
13
11
|
gem 'thor'
|
14
|
-
gem '
|
12
|
+
gem 'rails', '~> 3.0.9'
|
13
|
+
gem 'genspec'
|
15
14
|
end
|
data/Gemfile.lock
CHANGED
@@ -2,119 +2,107 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
abstract (1.0.0)
|
5
|
-
actionmailer (3.0.
|
6
|
-
actionpack (= 3.0.
|
5
|
+
actionmailer (3.0.13)
|
6
|
+
actionpack (= 3.0.13)
|
7
7
|
mail (~> 2.2.19)
|
8
|
-
actionpack (3.0.
|
9
|
-
activemodel (= 3.0.
|
10
|
-
activesupport (= 3.0.
|
8
|
+
actionpack (3.0.13)
|
9
|
+
activemodel (= 3.0.13)
|
10
|
+
activesupport (= 3.0.13)
|
11
11
|
builder (~> 2.1.2)
|
12
12
|
erubis (~> 2.6.6)
|
13
13
|
i18n (~> 0.5.0)
|
14
|
-
rack (~> 1.2.
|
14
|
+
rack (~> 1.2.5)
|
15
15
|
rack-mount (~> 0.6.14)
|
16
16
|
rack-test (~> 0.5.7)
|
17
17
|
tzinfo (~> 0.3.23)
|
18
|
-
activemodel (3.0.
|
19
|
-
activesupport (= 3.0.
|
18
|
+
activemodel (3.0.13)
|
19
|
+
activesupport (= 3.0.13)
|
20
20
|
builder (~> 2.1.2)
|
21
21
|
i18n (~> 0.5.0)
|
22
|
-
activerecord (3.0.
|
23
|
-
activemodel (= 3.0.
|
24
|
-
activesupport (= 3.0.
|
22
|
+
activerecord (3.0.13)
|
23
|
+
activemodel (= 3.0.13)
|
24
|
+
activesupport (= 3.0.13)
|
25
25
|
arel (~> 2.0.10)
|
26
26
|
tzinfo (~> 0.3.23)
|
27
|
-
activeresource (3.0.
|
28
|
-
activemodel (= 3.0.
|
29
|
-
activesupport (= 3.0.
|
30
|
-
activesupport (3.0.
|
27
|
+
activeresource (3.0.13)
|
28
|
+
activemodel (= 3.0.13)
|
29
|
+
activesupport (= 3.0.13)
|
30
|
+
activesupport (3.0.13)
|
31
31
|
arel (2.0.10)
|
32
|
-
awesome_print (0.
|
33
|
-
aws (2.
|
34
|
-
activesupport
|
32
|
+
awesome_print (1.0.2)
|
33
|
+
aws (2.5.6)
|
35
34
|
http_connection
|
36
35
|
uuidtools
|
37
36
|
xml-simple
|
38
37
|
builder (2.1.2)
|
39
|
-
|
40
|
-
diff-lcs (1.1.2)
|
38
|
+
diff-lcs (1.1.3)
|
41
39
|
erubis (2.6.6)
|
42
40
|
abstract (>= 1.0.0)
|
43
|
-
genspec (0.2.
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
genspec (0.2.6)
|
42
|
+
i18n (>= 0.5.0)
|
43
|
+
rspec (~> 2)
|
44
|
+
sc-core-ext (~> 1.2.1)
|
45
|
+
thor (~> 0.14.6)
|
47
46
|
http_connection (1.4.1)
|
48
47
|
i18n (0.5.0)
|
49
|
-
|
50
|
-
bundler (~> 1.0)
|
51
|
-
git (>= 1.2.5)
|
52
|
-
rake
|
53
|
-
linecache (0.46)
|
54
|
-
rbx-require-relative (> 0.0.4)
|
48
|
+
json (1.7.3)
|
55
49
|
mail (2.2.19)
|
56
50
|
activesupport (>= 2.3.6)
|
57
51
|
i18n (>= 0.4.0)
|
58
52
|
mime-types (~> 1.16)
|
59
53
|
treetop (~> 1.4.8)
|
60
|
-
mime-types (1.
|
61
|
-
polyglot (0.3.
|
62
|
-
rack (1.2.
|
54
|
+
mime-types (1.18)
|
55
|
+
polyglot (0.3.3)
|
56
|
+
rack (1.2.5)
|
63
57
|
rack-mount (0.6.14)
|
64
58
|
rack (>= 1.0.0)
|
65
59
|
rack-test (0.5.7)
|
66
60
|
rack (>= 1.0)
|
67
|
-
rails (3.0.
|
68
|
-
actionmailer (= 3.0.
|
69
|
-
actionpack (= 3.0.
|
70
|
-
activerecord (= 3.0.
|
71
|
-
activeresource (= 3.0.
|
72
|
-
activesupport (= 3.0.
|
61
|
+
rails (3.0.13)
|
62
|
+
actionmailer (= 3.0.13)
|
63
|
+
actionpack (= 3.0.13)
|
64
|
+
activerecord (= 3.0.13)
|
65
|
+
activeresource (= 3.0.13)
|
66
|
+
activesupport (= 3.0.13)
|
73
67
|
bundler (~> 1.0)
|
74
|
-
railties (= 3.0.
|
75
|
-
railties (3.0.
|
76
|
-
actionpack (= 3.0.
|
77
|
-
activesupport (= 3.0.
|
68
|
+
railties (= 3.0.13)
|
69
|
+
railties (3.0.13)
|
70
|
+
actionpack (= 3.0.13)
|
71
|
+
activesupport (= 3.0.13)
|
78
72
|
rake (>= 0.8.7)
|
79
73
|
rdoc (~> 3.4)
|
80
74
|
thor (~> 0.14.4)
|
81
|
-
rake (0.9.2)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
rspec-
|
87
|
-
rspec-
|
88
|
-
|
89
|
-
rspec-
|
90
|
-
|
91
|
-
|
92
|
-
rspec-mocks (2.3.0)
|
93
|
-
ruby-debug (0.10.4)
|
94
|
-
columnize (>= 0.1)
|
95
|
-
ruby-debug-base (~> 0.10.4.0)
|
96
|
-
ruby-debug-base (0.10.4)
|
97
|
-
linecache (>= 0.3)
|
75
|
+
rake (0.9.2.2)
|
76
|
+
rdoc (3.12)
|
77
|
+
json (~> 1.4)
|
78
|
+
rspec (2.10.0)
|
79
|
+
rspec-core (~> 2.10.0)
|
80
|
+
rspec-expectations (~> 2.10.0)
|
81
|
+
rspec-mocks (~> 2.10.0)
|
82
|
+
rspec-core (2.10.1)
|
83
|
+
rspec-expectations (2.10.0)
|
84
|
+
diff-lcs (~> 1.1.3)
|
85
|
+
rspec-mocks (2.10.1)
|
98
86
|
sc-core-ext (1.2.1)
|
99
87
|
activesupport (>= 2.3.5)
|
100
88
|
thor (0.14.6)
|
101
|
-
treetop (1.4.
|
89
|
+
treetop (1.4.10)
|
90
|
+
polyglot
|
102
91
|
polyglot (>= 0.3.1)
|
103
|
-
tzinfo (0.3.
|
92
|
+
tzinfo (0.3.33)
|
104
93
|
uuidtools (2.1.2)
|
105
|
-
xml-simple (1.1.
|
94
|
+
xml-simple (1.1.1)
|
106
95
|
|
107
96
|
PLATFORMS
|
108
97
|
ruby
|
109
98
|
|
110
99
|
DEPENDENCIES
|
100
|
+
activerecord (~> 3.0.9)
|
111
101
|
awesome_print
|
112
|
-
aws
|
113
|
-
genspec
|
114
|
-
jeweler
|
102
|
+
aws
|
103
|
+
genspec
|
115
104
|
rails (~> 3.0.9)
|
116
|
-
|
117
|
-
rspec
|
118
|
-
ruby-debug
|
105
|
+
rake
|
106
|
+
rspec
|
119
107
|
thor
|
120
|
-
uuidtools
|
108
|
+
uuidtools
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'rspec/core'
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
15
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
19
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
20
|
+
spec.rcov = true
|
21
|
+
end
|
22
|
+
|
23
|
+
task :default => :spec
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.11
|
@@ -1,85 +1,26 @@
|
|
1
|
-
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
5
2
|
|
6
3
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
4
|
+
s.name = %q{activerecord-simpledb-adapter}
|
5
|
+
s.version = "0.4.12"
|
6
|
+
s.authors = ["Ilia Ablamonov", "Alex Gorkunov", "Cloud Castle Inc."]
|
7
|
+
s.email = %q{ilia@flamefork.ru}
|
8
|
+
s.licenses = ["MIT"]
|
9
|
+
s.homepage = %q{http://www.github.com/gorkunov/consular-another-gnome-terminal}
|
10
|
+
s.summary = %q{Gnome Terminal support for Consular (without using xdotool)}
|
11
|
+
s.description = %q{Gnome Terminal support for Consular without emulation keyboard events}
|
12
|
+
s.homepage = %q{http://github.com/cloudcastle/activerecord-simpledb-adapter}
|
9
13
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.date = %q{2011-07-26}
|
13
|
-
s.email = %q{ilia@flamefork.ru}
|
14
|
-
s.extra_rdoc_files = [
|
15
|
-
"LICENSE.txt",
|
16
|
-
"README.md"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"Gemfile",
|
20
|
-
"Gemfile.lock",
|
21
|
-
"LICENSE.txt",
|
22
|
-
"README.md",
|
23
|
-
"activerecord-simpledb-adapter.gemspec",
|
24
|
-
"lib/active_record/connection_adapters/simpledb_adapter.rb",
|
25
|
-
"lib/active_record/connection_adapters/simpledb_adapter/adapter.rb",
|
26
|
-
"lib/active_record/connection_adapters/simpledb_adapter/base.rb",
|
27
|
-
"lib/active_record/connection_adapters/simpledb_adapter/column.rb",
|
28
|
-
"lib/active_record/connection_adapters/simpledb_adapter/defaults.rb",
|
29
|
-
"lib/active_record/connection_adapters/simpledb_adapter/finder_methods.rb",
|
30
|
-
"lib/active_record/connection_adapters/simpledb_adapter/misc/aws_overrides.rb",
|
31
|
-
"lib/active_record/connection_adapters/simpledb_adapter/misc/simpledb_logger.rb",
|
32
|
-
"lib/active_record/connection_adapters/simpledb_adapter/table_definition.rb",
|
33
|
-
"lib/active_record/connection_adapters/simpledb_adapter/validations.rb",
|
34
|
-
"lib/activerecord-simpledb-adapter.rb",
|
35
|
-
"lib/arel/visitors/simpledb.rb",
|
36
|
-
"lib/generators/active_record/model/model_generator.rb",
|
37
|
-
"lib/generators/active_record/model/templates/model.rb",
|
38
|
-
"lib/tasks/simpledb.rake"
|
39
|
-
]
|
40
|
-
s.homepage = %q{http://github.com/cloudcastle/activerecord-simpledb-adapter}
|
41
|
-
s.licenses = ["MIT"]
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
42
16
|
s.require_paths = ["lib"]
|
43
|
-
s.rubygems_version = %q{1.6.2}
|
44
|
-
s.summary = %q{ActiveRecord SimpleDB adapter}
|
45
17
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
55
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
56
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<genspec>, ["= 0.2.0.prerails3.2"])
|
58
|
-
s.add_development_dependency(%q<thor>, [">= 0"])
|
59
|
-
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<aws>, ["~> 2.3.0"])
|
62
|
-
s.add_dependency(%q<rails>, ["~> 3.0.9"])
|
63
|
-
s.add_dependency(%q<uuidtools>, ["~> 2.1.1"])
|
64
|
-
s.add_dependency(%q<awesome_print>, [">= 0"])
|
65
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
66
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
67
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
68
|
-
s.add_dependency(%q<genspec>, ["= 0.2.0.prerails3.2"])
|
69
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
70
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
71
|
-
end
|
72
|
-
else
|
73
|
-
s.add_dependency(%q<aws>, ["~> 2.3.0"])
|
74
|
-
s.add_dependency(%q<rails>, ["~> 3.0.9"])
|
75
|
-
s.add_dependency(%q<uuidtools>, ["~> 2.1.1"])
|
76
|
-
s.add_dependency(%q<awesome_print>, [">= 0"])
|
77
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
78
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
79
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
80
|
-
s.add_dependency(%q<genspec>, ["= 0.2.0.prerails3.2"])
|
81
|
-
s.add_dependency(%q<thor>, [">= 0"])
|
82
|
-
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
83
|
-
end
|
18
|
+
s.add_runtime_dependency(%q<aws>)
|
19
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.9"])
|
20
|
+
s.add_runtime_dependency(%q<uuidtools>)
|
21
|
+
s.add_development_dependency(%q<awesome_print>)
|
22
|
+
s.add_development_dependency(%q<rspec>)
|
23
|
+
s.add_development_dependency(%q<rails>, ["~> 3.0.9"])
|
24
|
+
s.add_development_dependency(%q<genspec>)
|
25
|
+
s.add_development_dependency(%q<thor>)
|
84
26
|
end
|
85
|
-
|
@@ -1,16 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
generators do
|
8
|
-
require 'generators/active_record/model/model_generator'
|
9
|
-
end
|
10
|
-
|
11
|
-
ActiveSupport.on_load(:active_record) do
|
12
|
-
require 'active_record/connection_adapters/simpledb_adapter'
|
13
|
-
require 'arel/visitors/simpledb'
|
14
|
-
end
|
15
|
-
end
|
1
|
+
if defined?(Rails)
|
2
|
+
require "railtie"
|
3
|
+
else
|
4
|
+
require 'active_record/connection_adapters/simpledb_adapter'
|
5
|
+
require 'arel/visitors/simpledb'
|
16
6
|
end
|
data/lib/railtie.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module ActiveRecordSimpledbAdapter
|
2
|
+
class Railtie < ::Rails::Railtie
|
3
|
+
rake_tasks do
|
4
|
+
load 'tasks/simpledb.rake'
|
5
|
+
end
|
6
|
+
|
7
|
+
generators do
|
8
|
+
require 'generators/active_record/model/model_generator'
|
9
|
+
end
|
10
|
+
|
11
|
+
ActiveSupport.on_load(:active_record) do
|
12
|
+
require 'active_record/connection_adapters/simpledb_adapter'
|
13
|
+
require 'arel/visitors/simpledb'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe "SimpleDBAdapter ActiveRecord associations" do
|
3
|
+
class Bar < ActiveRecord::Base
|
4
|
+
columns_definition do |t|
|
5
|
+
t.json :bar
|
6
|
+
end
|
7
|
+
has_many :fars
|
8
|
+
end
|
9
|
+
class Far < ActiveRecord::Base
|
10
|
+
columns_definition do |t|
|
11
|
+
t.json :bar
|
12
|
+
t.string :bar_id
|
13
|
+
end
|
14
|
+
belongs_to :bar
|
15
|
+
end
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
19
|
+
ActiveRecord::Base.establish_connection($config)
|
20
|
+
ActiveRecord::Base.connection.create_domain($config[:domain_name])
|
21
|
+
end
|
22
|
+
|
23
|
+
after :each do
|
24
|
+
ActiveRecord::Base.connection.delete_domain($config[:domain_name])
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create has many recources" do
|
28
|
+
t = Bar.create!
|
29
|
+
t.fars.create!
|
30
|
+
t.fars.count.should == 1
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
#spec helpers difition
|
3
|
+
class F < ActiveRecord::Base
|
4
|
+
columns_definition do |t|
|
5
|
+
t.string :body
|
6
|
+
end
|
7
|
+
|
8
|
+
has_many :bs
|
9
|
+
after_save lambda { self.bs.create!({:body => "test"}) }
|
10
|
+
end
|
11
|
+
class B < ActiveRecord::Base
|
12
|
+
columns_definition do |t|
|
13
|
+
t.string :body
|
14
|
+
t.string :f_id
|
15
|
+
end
|
16
|
+
end
|
17
|
+
#testes
|
18
|
+
describe "SimpleDBAdapter ActiveRecord batches operation" do
|
19
|
+
|
20
|
+
before :each do
|
21
|
+
ActiveRecord::Base.logger = Logger.new(STDOUT)
|
22
|
+
ActiveRecord::Base.establish_connection($config)
|
23
|
+
ActiveRecord::Base.connection.create_domain($config[:domain_name])
|
24
|
+
end
|
25
|
+
|
26
|
+
after :each do
|
27
|
+
ActiveRecord::Base.connection.delete_domain($config[:domain_name])
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should work with usual create statments" do
|
31
|
+
count = 5
|
32
|
+
Person.batch do
|
33
|
+
count.times { |i| Person.create_valid }
|
34
|
+
Person.count.should == 0
|
35
|
+
end
|
36
|
+
items = Person.all
|
37
|
+
items.count.should == count
|
38
|
+
items.each { |item| item.is_valid? }
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should work with usual update statments" do
|
42
|
+
count = 5
|
43
|
+
items = []
|
44
|
+
count.times { items << Person.create_valid }
|
45
|
+
Person.batch do
|
46
|
+
items.each {|item| item.update_attributes({:login => 'test'}); item.save! }
|
47
|
+
end
|
48
|
+
items = Person.all
|
49
|
+
items.count.should == count
|
50
|
+
items.each { |item| item.login.should == 'test' }
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should work with usual destroy statments" do
|
54
|
+
count = 5
|
55
|
+
items = []
|
56
|
+
count.times { items << Person.create_valid }
|
57
|
+
Person.batch do
|
58
|
+
items.each {|item| item.destroy }
|
59
|
+
end
|
60
|
+
Person.count.should == 0
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should work with diferrent statments in one batch session" do
|
64
|
+
count = 5
|
65
|
+
items = []
|
66
|
+
count.times { items << Person.create_valid }
|
67
|
+
Person.batch do
|
68
|
+
items.each do |item|
|
69
|
+
item.destroy
|
70
|
+
Person.create_valid
|
71
|
+
end
|
72
|
+
end
|
73
|
+
Person.count.should == count
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should auto split to several batches when count of items more than BATCH_MAX_ITEM_COUNT" do
|
77
|
+
count = 50
|
78
|
+
Person.batch do
|
79
|
+
count.times { |i| Person.create_valid }
|
80
|
+
end
|
81
|
+
Person.count.should == count
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should batch internal operations too (sub-updates)" do
|
85
|
+
count = 5
|
86
|
+
F.batch do
|
87
|
+
count.times { F.create!({:body => "body"}) }
|
88
|
+
end
|
89
|
+
[F, B].each {|r| r.count.should == count }
|
90
|
+
end
|
91
|
+
end
|