ninja-model 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/.gitignore +1 -1
  2. data/Gemfile +1 -0
  3. data/Rakefile +6 -0
  4. data/lib/ninja_model.rb +23 -7
  5. data/lib/ninja_model/adapters.rb +25 -20
  6. data/lib/ninja_model/adapters/adapter_manager.rb +2 -0
  7. data/lib/ninja_model/adapters/adapter_pool.rb +2 -0
  8. data/lib/ninja_model/associations.rb +63 -101
  9. data/lib/ninja_model/associations/association.rb +146 -0
  10. data/lib/ninja_model/associations/association_scope.rb +39 -0
  11. data/lib/ninja_model/associations/belongs_to_association.rb +33 -21
  12. data/lib/ninja_model/associations/builder/association.rb +57 -0
  13. data/lib/ninja_model/associations/builder/belongs_to.rb +33 -0
  14. data/lib/ninja_model/associations/builder/collection_association.rb +60 -0
  15. data/lib/ninja_model/associations/builder/has_many.rb +11 -0
  16. data/lib/ninja_model/associations/builder/has_one.rb +20 -0
  17. data/lib/ninja_model/associations/builder/singular_association.rb +49 -0
  18. data/lib/ninja_model/associations/collection_association.rb +103 -0
  19. data/lib/ninja_model/associations/collection_proxy.rb +45 -0
  20. data/lib/ninja_model/associations/has_many_association.rb +19 -43
  21. data/lib/ninja_model/associations/has_one_association.rb +52 -6
  22. data/lib/ninja_model/associations/singular_association.rb +61 -0
  23. data/lib/ninja_model/attribute.rb +5 -2
  24. data/lib/ninja_model/attribute_methods.rb +35 -40
  25. data/lib/ninja_model/base.rb +31 -39
  26. data/lib/ninja_model/identity.rb +8 -6
  27. data/lib/ninja_model/rails_ext/active_record.rb +69 -225
  28. data/lib/ninja_model/railtie.rb +0 -9
  29. data/lib/ninja_model/reflection.rb +103 -20
  30. data/lib/ninja_model/relation.rb +2 -2
  31. data/lib/ninja_model/relation/query_methods.rb +16 -0
  32. data/lib/ninja_model/version.rb +1 -1
  33. data/ninja-model.gemspec +2 -1
  34. data/spec/db/schema.rb +15 -0
  35. data/spec/{ninja_model → lib/ninja_model}/adapters/abstract_adapter_spec.rb +0 -0
  36. data/spec/lib/ninja_model/adapters/adapter_manager_spec.rb +72 -0
  37. data/spec/lib/ninja_model/adapters/adapter_pool_spec.rb +230 -0
  38. data/spec/lib/ninja_model/adapters_spec.rb +120 -0
  39. data/spec/lib/ninja_model/associations/belongs_to_association_spec.rb +76 -0
  40. data/spec/lib/ninja_model/associations/has_many_association_spec.rb +118 -0
  41. data/spec/lib/ninja_model/associations/has_one_association_spec.rb +80 -0
  42. data/spec/{ninja_model → lib/ninja_model}/attribute_methods_spec.rb +2 -2
  43. data/spec/{ninja_model → lib/ninja_model}/attribute_spec.rb +4 -0
  44. data/spec/{ninja_model → lib/ninja_model}/base_spec.rb +0 -0
  45. data/spec/{ninja_model → lib/ninja_model}/identity_spec.rb +0 -0
  46. data/spec/{ninja_model → lib/ninja_model}/persistence_spec.rb +0 -0
  47. data/spec/{ninja_model → lib/ninja_model}/predicate_spec.rb +0 -0
  48. data/spec/{ninja_model → lib/ninja_model}/query_methods_spec.rb +0 -0
  49. data/spec/{ninja_model → lib/ninja_model}/reflection_spec.rb +7 -9
  50. data/spec/{ninja_model → lib/ninja_model}/relation_spec.rb +0 -0
  51. data/spec/{ninja_model → lib/ninja_model}/symbol_spec.rb +0 -0
  52. data/spec/{ninja_model → lib/ninja_model}/validation_spec.rb +0 -0
  53. data/spec/{ninja_model_spec.rb → lib/ninja_model_spec.rb} +0 -0
  54. data/spec/models/bio.rb +8 -0
  55. data/spec/models/body.rb +7 -0
  56. data/spec/models/category.rb +7 -0
  57. data/spec/models/email_address.rb +3 -0
  58. data/spec/models/post.rb +13 -0
  59. data/spec/models/tag.rb +3 -0
  60. data/spec/models/user.rb +4 -0
  61. data/spec/spec_helper.rb +38 -5
  62. data/spec/support/dummy_adapter/adapter.rb +48 -0
  63. data/spec/support/factories/bio.rb +11 -0
  64. data/spec/support/factories/body.rb +12 -0
  65. data/spec/support/factories/email_address.rb +5 -0
  66. data/spec/support/factories/post.rb +12 -0
  67. data/spec/support/factories/tag.rb +5 -0
  68. data/spec/support/factories/user.rb +5 -0
  69. metadata +121 -63
  70. data/spec/ninja_model/adapters/adapter_manager_spec.rb +0 -69
  71. data/spec/ninja_model/adapters/adapter_pool_spec.rb +0 -230
  72. data/spec/ninja_model/adapters_spec.rb +0 -85
@@ -0,0 +1,48 @@
1
+ module DummyAdapter
2
+ class Adapter < NinjaModel::Adapters::AbstractAdapter
3
+ extend ActiveSupport::Autoload
4
+
5
+ def initilalize(config, logger = nil)
6
+ super
7
+ @active = false
8
+ end
9
+
10
+ def reconnect!
11
+ disconnect!
12
+ connect
13
+ end
14
+
15
+ def disconnect!
16
+ nil
17
+ end
18
+
19
+ def connect
20
+ end
21
+
22
+ def create(model)
23
+ execute :create, model
24
+ end
25
+
26
+ def read(query)
27
+ execute :read, query
28
+ end
29
+
30
+ def update(model)
31
+ execute :update, model
32
+ end
33
+
34
+ def destroy(model)
35
+ execute :destroy, model
36
+ end
37
+
38
+ def reload(model)
39
+ execute :reload, model
40
+ end
41
+
42
+ private
43
+
44
+ def execute(method, object)
45
+ raise NotImplementedError, "I should have been stubbed!"
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,11 @@
1
+ FactoryGirl.define do
2
+ factory :bio do
3
+ association :user
4
+ sequence(:name) { |n| "Name #{n}" }
5
+ to_create { |model|
6
+ model.write_attribute(:id, 1)
7
+ model.stubs(:persisted?).returns(true)
8
+ model.stubs(:new_record?).returns(false)
9
+ }
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ FactoryGirl.define do
2
+ factory :body do
3
+ association :post
4
+ sequence(:text) { |n| "Body #{n}" }
5
+ to_create { |model|
6
+ model.write_attribute(:id, 1)
7
+ model.stubs(:persisted?).returns(true)
8
+ model.stubs(:new_record?).returns(false)
9
+ }
10
+ end
11
+ end
12
+
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :email_address do
3
+ sequence(:email) { |n| "user#{n}@example.com" }
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ FactoryGirl.define do
2
+ factory :post do
3
+ association :user
4
+ sequence(:title) { |n| "Title #{n}" }
5
+ published false
6
+ to_create { |model|
7
+ model.write_attribute(:id, 1)
8
+ model.stubs(:persisted?).returns(true)
9
+ model.stubs(:new_record?).returns(false)
10
+ }
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :tag do
3
+ sequence(:name) { |n| "Tag #{n}" }
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryGirl.define do
2
+ factory :user do
3
+ sequence(:username) { |n| "User#{n}" }
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ninja-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-04 00:00:00.000000000Z
12
+ date: 2012-02-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &9388120 !ruby/object:Gem::Requirement
16
+ requirement: &13989660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9388120
24
+ version_requirements: *13989660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &9387240 !ruby/object:Gem::Requirement
27
+ requirement: &13988620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *9387240
35
+ version_requirements: *13988620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &9386660 !ruby/object:Gem::Requirement
38
+ requirement: &13987680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.8.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *9386660
46
+ version_requirements: *13987680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &9383260 !ruby/object:Gem::Requirement
49
+ requirement: &13986480 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,21 +54,10 @@ dependencies:
54
54
  version: 0.10.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *9383260
58
- - !ruby/object:Gem::Dependency
59
- name: nokogiri
60
- requirement: &9382620 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ~>
64
- - !ruby/object:Gem::Version
65
- version: 1.5.0
66
- type: :development
67
- prerelease: false
68
- version_requirements: *9382620
57
+ version_requirements: *13986480
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: guard-rspec
71
- requirement: &9381940 !ruby/object:Gem::Requirement
60
+ requirement: &13985720 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ~>
@@ -76,10 +65,10 @@ dependencies:
76
65
  version: 0.5.10
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *9381940
68
+ version_requirements: *13985720
80
69
  - !ruby/object:Gem::Dependency
81
70
  name: libnotify
82
- requirement: &9381280 !ruby/object:Gem::Requirement
71
+ requirement: &13984420 !ruby/object:Gem::Requirement
83
72
  none: false
84
73
  requirements:
85
74
  - - ~>
@@ -87,10 +76,10 @@ dependencies:
87
76
  version: 0.6.0
88
77
  type: :development
89
78
  prerelease: false
90
- version_requirements: *9381280
79
+ version_requirements: *13984420
91
80
  - !ruby/object:Gem::Dependency
92
81
  name: yard
93
- requirement: &9380660 !ruby/object:Gem::Requirement
82
+ requirement: &13983440 !ruby/object:Gem::Requirement
94
83
  none: false
95
84
  requirements:
96
85
  - - ~>
@@ -98,10 +87,10 @@ dependencies:
98
87
  version: 0.7.4
99
88
  type: :development
100
89
  prerelease: false
101
- version_requirements: *9380660
90
+ version_requirements: *13983440
102
91
  - !ruby/object:Gem::Dependency
103
92
  name: redcarpet
104
- requirement: &9379980 !ruby/object:Gem::Requirement
93
+ requirement: &13982400 !ruby/object:Gem::Requirement
105
94
  none: false
106
95
  requirements:
107
96
  - - ~>
@@ -109,7 +98,29 @@ dependencies:
109
98
  version: 2.0.0
110
99
  type: :development
111
100
  prerelease: false
112
- version_requirements: *9379980
101
+ version_requirements: *13982400
102
+ - !ruby/object:Gem::Dependency
103
+ name: sqlite3
104
+ requirement: &13981760 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.3.5
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *13981760
113
+ - !ruby/object:Gem::Dependency
114
+ name: factory_girl
115
+ requirement: &13981220 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: 2.5.0
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *13981220
113
124
  description: Pseudo-ORM for Ruby/Rails with an ActiveRecord-like interface
114
125
  email: theprime@codingprime.com
115
126
  executables: []
@@ -135,10 +146,21 @@ files:
135
146
  - lib/ninja_model/adapters/adapter_pool.rb
136
147
  - lib/ninja_model/adapters/adapter_specification.rb
137
148
  - lib/ninja_model/associations.rb
149
+ - lib/ninja_model/associations/association.rb
138
150
  - lib/ninja_model/associations/association_proxy.rb
151
+ - lib/ninja_model/associations/association_scope.rb
139
152
  - lib/ninja_model/associations/belongs_to_association.rb
153
+ - lib/ninja_model/associations/builder/association.rb
154
+ - lib/ninja_model/associations/builder/belongs_to.rb
155
+ - lib/ninja_model/associations/builder/collection_association.rb
156
+ - lib/ninja_model/associations/builder/has_many.rb
157
+ - lib/ninja_model/associations/builder/has_one.rb
158
+ - lib/ninja_model/associations/builder/singular_association.rb
159
+ - lib/ninja_model/associations/collection_association.rb
160
+ - lib/ninja_model/associations/collection_proxy.rb
140
161
  - lib/ninja_model/associations/has_many_association.rb
141
162
  - lib/ninja_model/associations/has_one_association.rb
163
+ - lib/ninja_model/associations/singular_association.rb
142
164
  - lib/ninja_model/attribute.rb
143
165
  - lib/ninja_model/attribute_methods.rb
144
166
  - lib/ninja_model/base.rb
@@ -157,24 +179,42 @@ files:
157
179
  - lib/ninja_model/validation.rb
158
180
  - lib/ninja_model/version.rb
159
181
  - ninja-model.gemspec
160
- - spec/ninja_model/adapters/abstract_adapter_spec.rb
161
- - spec/ninja_model/adapters/adapter_manager_spec.rb
162
- - spec/ninja_model/adapters/adapter_pool_spec.rb
163
- - spec/ninja_model/adapters_spec.rb
164
- - spec/ninja_model/attribute_methods_spec.rb
165
- - spec/ninja_model/attribute_spec.rb
166
- - spec/ninja_model/base_spec.rb
167
- - spec/ninja_model/identity_spec.rb
168
- - spec/ninja_model/persistence_spec.rb
169
- - spec/ninja_model/predicate_spec.rb
170
- - spec/ninja_model/query_methods_spec.rb
171
- - spec/ninja_model/reflection_spec.rb
172
- - spec/ninja_model/relation_spec.rb
173
- - spec/ninja_model/symbol_spec.rb
174
- - spec/ninja_model/validation_spec.rb
175
- - spec/ninja_model_spec.rb
182
+ - spec/db/schema.rb
183
+ - spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
184
+ - spec/lib/ninja_model/adapters/adapter_manager_spec.rb
185
+ - spec/lib/ninja_model/adapters/adapter_pool_spec.rb
186
+ - spec/lib/ninja_model/adapters_spec.rb
187
+ - spec/lib/ninja_model/associations/belongs_to_association_spec.rb
188
+ - spec/lib/ninja_model/associations/has_many_association_spec.rb
189
+ - spec/lib/ninja_model/associations/has_one_association_spec.rb
190
+ - spec/lib/ninja_model/attribute_methods_spec.rb
191
+ - spec/lib/ninja_model/attribute_spec.rb
192
+ - spec/lib/ninja_model/base_spec.rb
193
+ - spec/lib/ninja_model/identity_spec.rb
194
+ - spec/lib/ninja_model/persistence_spec.rb
195
+ - spec/lib/ninja_model/predicate_spec.rb
196
+ - spec/lib/ninja_model/query_methods_spec.rb
197
+ - spec/lib/ninja_model/reflection_spec.rb
198
+ - spec/lib/ninja_model/relation_spec.rb
199
+ - spec/lib/ninja_model/symbol_spec.rb
200
+ - spec/lib/ninja_model/validation_spec.rb
201
+ - spec/lib/ninja_model_spec.rb
202
+ - spec/models/bio.rb
203
+ - spec/models/body.rb
204
+ - spec/models/category.rb
205
+ - spec/models/email_address.rb
206
+ - spec/models/post.rb
207
+ - spec/models/tag.rb
208
+ - spec/models/user.rb
176
209
  - spec/spec_helper.rb
177
210
  - spec/support/active_model_lint.rb
211
+ - spec/support/dummy_adapter/adapter.rb
212
+ - spec/support/factories/bio.rb
213
+ - spec/support/factories/body.rb
214
+ - spec/support/factories/email_address.rb
215
+ - spec/support/factories/post.rb
216
+ - spec/support/factories/tag.rb
217
+ - spec/support/factories/user.rb
178
218
  - spec/support/matchers/convert.rb
179
219
  homepage: http://github.com/t3hpr1m3/ninja-model.git
180
220
  licenses: []
@@ -190,7 +230,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
230
  version: '0'
191
231
  segments:
192
232
  - 0
193
- hash: -2496958608719154652
233
+ hash: -4215966564310549894
194
234
  required_rubygems_version: !ruby/object:Gem::Requirement
195
235
  none: false
196
236
  requirements:
@@ -199,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
239
  version: '0'
200
240
  segments:
201
241
  - 0
202
- hash: -2496958608719154652
242
+ hash: -4215966564310549894
203
243
  requirements: []
204
244
  rubyforge_project: ninja-model
205
245
  rubygems_version: 1.8.10
@@ -207,23 +247,41 @@ signing_key:
207
247
  specification_version: 3
208
248
  summary: Pseudo-ORM for Ruby
209
249
  test_files:
210
- - spec/ninja_model/adapters/abstract_adapter_spec.rb
211
- - spec/ninja_model/adapters/adapter_manager_spec.rb
212
- - spec/ninja_model/adapters/adapter_pool_spec.rb
213
- - spec/ninja_model/adapters_spec.rb
214
- - spec/ninja_model/attribute_methods_spec.rb
215
- - spec/ninja_model/attribute_spec.rb
216
- - spec/ninja_model/base_spec.rb
217
- - spec/ninja_model/identity_spec.rb
218
- - spec/ninja_model/persistence_spec.rb
219
- - spec/ninja_model/predicate_spec.rb
220
- - spec/ninja_model/query_methods_spec.rb
221
- - spec/ninja_model/reflection_spec.rb
222
- - spec/ninja_model/relation_spec.rb
223
- - spec/ninja_model/symbol_spec.rb
224
- - spec/ninja_model/validation_spec.rb
225
- - spec/ninja_model_spec.rb
250
+ - spec/db/schema.rb
251
+ - spec/lib/ninja_model/adapters/abstract_adapter_spec.rb
252
+ - spec/lib/ninja_model/adapters/adapter_manager_spec.rb
253
+ - spec/lib/ninja_model/adapters/adapter_pool_spec.rb
254
+ - spec/lib/ninja_model/adapters_spec.rb
255
+ - spec/lib/ninja_model/associations/belongs_to_association_spec.rb
256
+ - spec/lib/ninja_model/associations/has_many_association_spec.rb
257
+ - spec/lib/ninja_model/associations/has_one_association_spec.rb
258
+ - spec/lib/ninja_model/attribute_methods_spec.rb
259
+ - spec/lib/ninja_model/attribute_spec.rb
260
+ - spec/lib/ninja_model/base_spec.rb
261
+ - spec/lib/ninja_model/identity_spec.rb
262
+ - spec/lib/ninja_model/persistence_spec.rb
263
+ - spec/lib/ninja_model/predicate_spec.rb
264
+ - spec/lib/ninja_model/query_methods_spec.rb
265
+ - spec/lib/ninja_model/reflection_spec.rb
266
+ - spec/lib/ninja_model/relation_spec.rb
267
+ - spec/lib/ninja_model/symbol_spec.rb
268
+ - spec/lib/ninja_model/validation_spec.rb
269
+ - spec/lib/ninja_model_spec.rb
270
+ - spec/models/bio.rb
271
+ - spec/models/body.rb
272
+ - spec/models/category.rb
273
+ - spec/models/email_address.rb
274
+ - spec/models/post.rb
275
+ - spec/models/tag.rb
276
+ - spec/models/user.rb
226
277
  - spec/spec_helper.rb
227
278
  - spec/support/active_model_lint.rb
279
+ - spec/support/dummy_adapter/adapter.rb
280
+ - spec/support/factories/bio.rb
281
+ - spec/support/factories/body.rb
282
+ - spec/support/factories/email_address.rb
283
+ - spec/support/factories/post.rb
284
+ - spec/support/factories/tag.rb
285
+ - spec/support/factories/user.rb
228
286
  - spec/support/matchers/convert.rb
229
287
  has_rdoc:
@@ -1,69 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe NinjaModel::Adapters::AdapterManager do
4
- class DummyAdapter < NinjaModel::Adapters::AbstractAdapter; end
5
- class TestModel < NinjaModel::Base; end
6
- class ChildModel < TestModel; end
7
-
8
- before {
9
- @manager = NinjaModel::Adapters::AdapterManager.new
10
- @manager.class.register_adapter_class(:dummy, DummyAdapter)
11
- }
12
- subject { @manager }
13
-
14
- it 'should remember registered adapters' do
15
- subject.class.registered?(:dummy).should be_true
16
- end
17
-
18
- describe 'creating an adapter' do
19
- before { @manager.create_adapter('TestModel', NinjaModel::Adapters::AdapterSpecification.new({}, :dummy)) }
20
- it 'should add the adapter to the pool' do
21
- @manager.retrieve_adapter_pool(TestModel).spec.name.should eql(:dummy)
22
- end
23
- it 'should return the adapter for descendent classes' do
24
- @manager.retrieve_adapter_pool(ChildModel).spec.name.should eql(:dummy)
25
- end
26
- end
27
-
28
- describe 'removing an adapter' do
29
- before {
30
- @spec = NinjaModel::Adapters::AdapterSpecification.new({:foo => 'bar'}, :dummy)
31
- @manager.create_adapter('TestModel', @spec)
32
- }
33
- it 'should remove the adapter from the pool' do
34
- @manager.remove_adapter(TestModel)
35
- @manager.retrieve_adapter_pool(TestModel).should be_nil
36
- end
37
- it 'should cause retrieve_adapter to raise an error' do
38
- @manager.remove_adapter(TestModel)
39
- lambda { @manager.retrieve_adapter(TestModel) }.should raise_error(StandardError)
40
- end
41
- it 'should return the spec that created it' do
42
- @manager.remove_adapter(TestModel).should eql({:foo => 'bar'})
43
- end
44
- end
45
-
46
- describe 'release_active_adapters!' do
47
- before {
48
- @spec = NinjaModel::Adapters::AdapterSpecification.new({:foo => 'bar'}, :dummy)
49
- @manager.create_adapter('TestModel', @spec)
50
- }
51
- it 'should call release_instance on all pools' do
52
- @pool = @manager.adapter_pools['TestModel']
53
- @pool.expects(:release_instance)
54
- @manager.release_active_adapters!
55
- end
56
- end
57
-
58
- describe 'release_all_adapters!' do
59
- before {
60
- @spec = NinjaModel::Adapters::AdapterSpecification.new({:foo => 'bar'}, :dummy)
61
- @manager.create_adapter('TestModel', @spec)
62
- }
63
- it 'should call shutdown! on all pools' do
64
- @pool = @manager.adapter_pools['TestModel']
65
- @pool.expects(:shutdown!)
66
- @manager.release_all_adapters!
67
- end
68
- end
69
- end