guacamole 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +3 -0
  3. data/{config/reek.yml → .reek.yml} +5 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG.md +19 -0
  6. data/GOALS.md +20 -0
  7. data/Gemfile +1 -11
  8. data/Guardfile +0 -4
  9. data/README.md +147 -11
  10. data/Rakefile +33 -3
  11. data/guacamole.gemspec +12 -1
  12. data/lib/guacamole.rb +1 -0
  13. data/lib/guacamole/callbacks.rb +259 -0
  14. data/lib/guacamole/collection.rb +50 -32
  15. data/lib/guacamole/configuration.rb +92 -15
  16. data/lib/guacamole/model.rb +39 -1
  17. data/lib/guacamole/railtie.rb +9 -3
  18. data/lib/guacamole/version.rb +1 -1
  19. data/lib/rails/generators/guacamole/callbacks/callbacks_generator.rb +26 -0
  20. data/lib/rails/generators/guacamole/callbacks/templates/callbacks.rb.tt +13 -0
  21. data/lib/rails/generators/rspec/callbacks/callbacks_generator.rb +14 -0
  22. data/lib/rails/generators/rspec/callbacks/templates/callbacks_spec.rb.tt +7 -0
  23. data/lib/rails/generators/test_unit/callbacks/callbacks_generator.rb +13 -0
  24. data/lib/rails/generators/test_unit/callbacks/templates/callbacks_test.rb.tt +9 -0
  25. data/lib/rails/generators/test_unit/collection/collection_generator.rb +13 -0
  26. data/lib/rails/generators/test_unit/collection/templates/collection_test.rb.tt +10 -0
  27. data/spec/acceptance/aql_spec.rb +0 -12
  28. data/spec/acceptance/basic_spec.rb +16 -25
  29. data/spec/acceptance/callbacks_spec.rb +181 -0
  30. data/spec/acceptance/config/guacamole.yml +1 -1
  31. data/spec/acceptance/spec_helper.rb +24 -6
  32. data/spec/fabricators/article.rb +12 -0
  33. data/spec/fabricators/comment.rb +7 -0
  34. data/spec/fabricators/pony.rb +6 -4
  35. data/spec/fabricators/pony_fabricator.rb +7 -0
  36. data/spec/spec_helper.rb +5 -4
  37. data/spec/support/guacamole.yml.erb +5 -0
  38. data/spec/unit/callbacks_spec.rb +139 -0
  39. data/spec/unit/collection_spec.rb +85 -66
  40. data/spec/unit/configuration_spec.rb +165 -21
  41. data/spec/unit/identiy_map_spec.rb +2 -2
  42. data/spec/unit/model_spec.rb +36 -3
  43. metadata +181 -12
  44. data/Gemfile.devtools +0 -67
  45. data/config/devtools.yml +0 -4
  46. data/config/flay.yml +0 -3
  47. data/config/flog.yml +0 -2
  48. data/config/mutant.yml +0 -3
  49. data/config/yardstick.yml +0 -2
  50. data/tasks/adjustments.rake +0 -34
@@ -99,14 +99,14 @@ describe Guacamole::IdentityMap do
99
99
  it 'should store the object in the map' do
100
100
  subject.store cupcake
101
101
 
102
- expect(subject.include?(cupcake)).to be_true
102
+ expect(subject.include?(cupcake)).to be true
103
103
  end
104
104
 
105
105
  it 'should use an immutable storage' do
106
106
  old_map = subject.identity_map_instance
107
107
  subject.store cupcake
108
108
 
109
- expect(old_map.key?(subject.key_for(cupcake))).to be_false
109
+ expect(old_map.key?(subject.key_for(cupcake))).to be false
110
110
  end
111
111
 
112
112
  it 'should return the stored object' do
@@ -14,12 +14,20 @@ end
14
14
  describe Guacamole::Model do
15
15
  subject { TestModel }
16
16
  let(:current_time) { Time.now }
17
+ let(:callbacks) { double('Callback') }
18
+ let(:callbacks_module) { double('CallbacksModule') }
19
+
20
+ before do
21
+ allow(callbacks_module).to receive(:callbacks_for).and_return(callbacks)
22
+ allow(callbacks).to receive(:run_callbacks).with(:validate).and_yield
23
+ stub_const('Guacamole::Callbacks', callbacks_module)
24
+ end
17
25
 
18
26
  describe 'module inclusion' do
19
27
  it 'should include Virtus.model' do
20
28
  expect(subject.ancestors.any? do |ancestor|
21
29
  ancestor.to_s.include? 'Virtus'
22
- end).to be_true
30
+ end).to be true
23
31
  end
24
32
 
25
33
  it 'should include ActiveModel::Validation' do
@@ -64,12 +72,37 @@ describe Guacamole::Model do
64
72
 
65
73
  it 'should be persisted if it has a key' do
66
74
  subject.key = 'my_key'
67
- expect(subject.persisted?).to be_true
75
+ expect(subject.persisted?).to be true
68
76
  end
69
77
 
70
78
  it "should not be persisted if it doesn't have a key" do
71
79
  subject.key = nil
72
- expect(subject.persisted?).to be_false
80
+ expect(subject.persisted?).to be false
81
+ end
82
+ end
83
+
84
+ describe 'callbacks' do
85
+ subject { TestModel.new }
86
+
87
+ it 'should register one callback class responsible for this model' do
88
+ awesome_callbacks_class = double('AwesomeCallbacksClass')
89
+ stub_const('AwesomeCallbacks', awesome_callbacks_class)
90
+ expect(callbacks_module).to receive(:register_callback).with(TestModel, awesome_callbacks_class)
91
+
92
+ TestModel.callbacks :awesome_callbacks
93
+ end
94
+
95
+ it 'should run validate callbacks on valid?' do
96
+ expect(callbacks).to receive(:run_callbacks).with(:validate).and_yield
97
+ expect(subject).to receive(:valid_without_callbacks?)
98
+
99
+ subject.valid?
100
+ end
101
+
102
+ it 'should provide method to get callback for self' do
103
+ expect(callbacks_module).to receive(:callbacks_for).with(subject)
104
+
105
+ subject.callbacks
73
106
  end
74
107
  end
75
108
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guacamole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Dohmen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-12 00:00:00.000000000 Z
12
+ date: 2014-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ashikawa-core
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.11.0
20
+ version: 0.12.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.11.0
27
+ version: 0.12.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: virtus
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +81,34 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: 1.0.1.pre.rc.1
84
+ - !ruby/object:Gem::Dependency
85
+ name: bcrypt
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '='
89
+ - !ruby/object:Gem::Version
90
+ version: 3.1.7
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '='
96
+ - !ruby/object:Gem::Version
97
+ version: 3.1.7
98
+ - !ruby/object:Gem::Dependency
99
+ name: codeclimate-test-reporter
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: 0.3.0
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: 0.3.0
84
112
  - !ruby/object:Gem::Dependency
85
113
  name: fabrication
86
114
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +137,62 @@ dependencies:
109
137
  - - "~>"
110
138
  - !ruby/object:Gem::Version
111
139
  version: 1.2.0
140
+ - !ruby/object:Gem::Dependency
141
+ name: guard
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: 2.6.1
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: 2.6.1
154
+ - !ruby/object:Gem::Dependency
155
+ name: guard-bundler
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: 2.0.0
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: 2.0.0
168
+ - !ruby/object:Gem::Dependency
169
+ name: guard-rspec
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: 4.2.10
175
+ type: :development
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: 4.2.10
182
+ - !ruby/object:Gem::Dependency
183
+ name: inch
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: 0.4.6
189
+ type: :development
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: 0.4.6
112
196
  - !ruby/object:Gem::Dependency
113
197
  name: logging
114
198
  requirement: !ruby/object:Gem::Requirement
@@ -137,6 +221,76 @@ dependencies:
137
221
  - - "~>"
138
222
  - !ruby/object:Gem::Version
139
223
  version: 0.9.12
224
+ - !ruby/object:Gem::Dependency
225
+ name: rake
226
+ requirement: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - "~>"
229
+ - !ruby/object:Gem::Version
230
+ version: 10.3.2
231
+ type: :development
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - "~>"
236
+ - !ruby/object:Gem::Version
237
+ version: 10.3.2
238
+ - !ruby/object:Gem::Dependency
239
+ name: reek
240
+ requirement: !ruby/object:Gem::Requirement
241
+ requirements:
242
+ - - "~>"
243
+ - !ruby/object:Gem::Version
244
+ version: 1.3.7
245
+ type: :development
246
+ prerelease: false
247
+ version_requirements: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - "~>"
250
+ - !ruby/object:Gem::Version
251
+ version: 1.3.7
252
+ - !ruby/object:Gem::Dependency
253
+ name: rspec
254
+ requirement: !ruby/object:Gem::Requirement
255
+ requirements:
256
+ - - "~>"
257
+ - !ruby/object:Gem::Version
258
+ version: 3.0.0
259
+ type: :development
260
+ prerelease: false
261
+ version_requirements: !ruby/object:Gem::Requirement
262
+ requirements:
263
+ - - "~>"
264
+ - !ruby/object:Gem::Version
265
+ version: 3.0.0
266
+ - !ruby/object:Gem::Dependency
267
+ name: timecop
268
+ requirement: !ruby/object:Gem::Requirement
269
+ requirements:
270
+ - - "~>"
271
+ - !ruby/object:Gem::Version
272
+ version: 0.7.1
273
+ type: :development
274
+ prerelease: false
275
+ version_requirements: !ruby/object:Gem::Requirement
276
+ requirements:
277
+ - - "~>"
278
+ - !ruby/object:Gem::Version
279
+ version: 0.7.1
280
+ - !ruby/object:Gem::Dependency
281
+ name: yard
282
+ requirement: !ruby/object:Gem::Requirement
283
+ requirements:
284
+ - - "~>"
285
+ - !ruby/object:Gem::Version
286
+ version: 0.8.7.4
287
+ type: :development
288
+ prerelease: false
289
+ version_requirements: !ruby/object:Gem::Requirement
290
+ requirements:
291
+ - - "~>"
292
+ - !ruby/object:Gem::Version
293
+ version: 0.8.7.4
140
294
  description: ODM for ArangoDB
141
295
  email:
142
296
  - moonglum@moonbeamlabs.com
@@ -147,27 +301,23 @@ extra_rdoc_files: []
147
301
  files:
148
302
  - ".gitignore"
149
303
  - ".hound.yml"
304
+ - ".reek.yml"
150
305
  - ".rspec"
151
306
  - ".ruby-version"
152
307
  - ".travis.yml"
153
308
  - ".yardopts"
154
309
  - CHANGELOG.md
155
310
  - CONTRIBUTING.md
311
+ - GOALS.md
156
312
  - Gemfile
157
- - Gemfile.devtools
158
313
  - Guardfile
159
314
  - LICENSE
160
315
  - README.md
161
316
  - Rakefile
162
- - config/devtools.yml
163
- - config/flay.yml
164
- - config/flog.yml
165
- - config/mutant.yml
166
- - config/reek.yml
167
- - config/yardstick.yml
168
317
  - guacamole.gemspec
169
318
  - lib/guacamole.rb
170
319
  - lib/guacamole/aql_query.rb
320
+ - lib/guacamole/callbacks.rb
171
321
  - lib/guacamole/collection.rb
172
322
  - lib/guacamole/configuration.rb
173
323
  - lib/guacamole/document_model_mapper.rb
@@ -182,6 +332,8 @@ files:
182
332
  - lib/guacamole/railtie/database.rake
183
333
  - lib/guacamole/tasks/database.rake
184
334
  - lib/guacamole/version.rb
335
+ - lib/rails/generators/guacamole/callbacks/callbacks_generator.rb
336
+ - lib/rails/generators/guacamole/callbacks/templates/callbacks.rb.tt
185
337
  - lib/rails/generators/guacamole/collection/collection_generator.rb
186
338
  - lib/rails/generators/guacamole/collection/templates/collection.rb.tt
187
339
  - lib/rails/generators/guacamole/config/config_generator.rb
@@ -190,25 +342,37 @@ files:
190
342
  - lib/rails/generators/guacamole/model/templates/model.rb.tt
191
343
  - lib/rails/generators/guacamole_generator.rb
192
344
  - lib/rails/generators/rails/collection/collection_generator.rb
345
+ - lib/rails/generators/rspec/callbacks/callbacks_generator.rb
346
+ - lib/rails/generators/rspec/callbacks/templates/callbacks_spec.rb.tt
193
347
  - lib/rails/generators/rspec/collection/collection_generator.rb
194
348
  - lib/rails/generators/rspec/collection/templates/collection_spec.rb.tt
349
+ - lib/rails/generators/test_unit/callbacks/callbacks_generator.rb
350
+ - lib/rails/generators/test_unit/callbacks/templates/callbacks_test.rb.tt
351
+ - lib/rails/generators/test_unit/collection/collection_generator.rb
352
+ - lib/rails/generators/test_unit/collection/templates/collection_test.rb.tt
195
353
  - log/.gitkeep
196
354
  - spec/acceptance/.gitkeep
197
355
  - spec/acceptance/aql_spec.rb
198
356
  - spec/acceptance/association_spec.rb
199
357
  - spec/acceptance/basic_spec.rb
358
+ - spec/acceptance/callbacks_spec.rb
200
359
  - spec/acceptance/config/guacamole.yml
201
360
  - spec/acceptance/spec_helper.rb
361
+ - spec/fabricators/article.rb
202
362
  - spec/fabricators/article_fabricator.rb
203
363
  - spec/fabricators/author.rb
204
364
  - spec/fabricators/author_fabricator.rb
205
365
  - spec/fabricators/book.rb
206
366
  - spec/fabricators/book_fabricator.rb
367
+ - spec/fabricators/comment.rb
207
368
  - spec/fabricators/comment_fabricator.rb
208
369
  - spec/fabricators/pony.rb
370
+ - spec/fabricators/pony_fabricator.rb
209
371
  - spec/setup/arangodb.sh
210
372
  - spec/spec_helper.rb
373
+ - spec/support/guacamole.yml.erb
211
374
  - spec/unit/.gitkeep
375
+ - spec/unit/callbacks_spec.rb
212
376
  - spec/unit/collection_spec.rb
213
377
  - spec/unit/configuration_spec.rb
214
378
  - spec/unit/document_model_mapper_spec.rb
@@ -216,7 +380,6 @@ files:
216
380
  - spec/unit/identiy_map_spec.rb
217
381
  - spec/unit/model_spec.rb
218
382
  - spec/unit/query_spec.rb
219
- - tasks/adjustments.rake
220
383
  homepage: http://guacamolegem.org
221
384
  licenses:
222
385
  - Apache License 2.0
@@ -246,18 +409,24 @@ test_files:
246
409
  - spec/acceptance/aql_spec.rb
247
410
  - spec/acceptance/association_spec.rb
248
411
  - spec/acceptance/basic_spec.rb
412
+ - spec/acceptance/callbacks_spec.rb
249
413
  - spec/acceptance/config/guacamole.yml
250
414
  - spec/acceptance/spec_helper.rb
415
+ - spec/fabricators/article.rb
251
416
  - spec/fabricators/article_fabricator.rb
252
417
  - spec/fabricators/author.rb
253
418
  - spec/fabricators/author_fabricator.rb
254
419
  - spec/fabricators/book.rb
255
420
  - spec/fabricators/book_fabricator.rb
421
+ - spec/fabricators/comment.rb
256
422
  - spec/fabricators/comment_fabricator.rb
257
423
  - spec/fabricators/pony.rb
424
+ - spec/fabricators/pony_fabricator.rb
258
425
  - spec/setup/arangodb.sh
259
426
  - spec/spec_helper.rb
427
+ - spec/support/guacamole.yml.erb
260
428
  - spec/unit/.gitkeep
429
+ - spec/unit/callbacks_spec.rb
261
430
  - spec/unit/collection_spec.rb
262
431
  - spec/unit/configuration_spec.rb
263
432
  - spec/unit/document_model_mapper_spec.rb
data/Gemfile.devtools DELETED
@@ -1,67 +0,0 @@
1
- # encoding: utf-8
2
-
3
- group :development do
4
- gem 'rake', '~> 10.1.0'
5
- gem 'rspec', '~> 2.14.1'
6
- gem 'yard', '~> 0.8.7'
7
-
8
- platform :rbx do
9
- gem 'rubysl-singleton', '~> 2.0.0'
10
- end
11
- end
12
-
13
- group :yard do
14
- gem 'kramdown', '~> 1.3.2'
15
- end
16
-
17
- group :guard do
18
- gem 'guard', '~> 2.4.0'
19
- gem 'guard-bundler', '~> 2.0.0'
20
- gem 'guard-rspec', '~> 4.2.6'
21
-
22
- # file system change event handling
23
- gem 'listen', '~> 2.5.0'
24
- gem 'rb-fchange', '~> 0.0.6', require: false
25
- gem 'rb-fsevent', '~> 0.9.3', require: false
26
- gem 'rb-inotify', '~> 0.9.0', require: false
27
-
28
- # notification handling
29
- gem 'libnotify', '~> 0.8.0', require: false
30
- gem 'rb-notifu', '~> 0.0.4', require: false
31
- gem 'terminal-notifier-guard', '~> 1.5.3', require: false
32
- end
33
-
34
- group :metrics do
35
- gem 'coveralls', '~> 0.7.0'
36
- gem 'flay', '~> 2.4.0'
37
- gem 'flog', '~> 4.2.0'
38
- gem 'reek', '~> 1.3.2'
39
- gem 'simplecov', '~> 0.8.2'
40
- gem 'yardstick', '~> 0.9.9'
41
-
42
- # platforms :mri do
43
- # gem 'mutant', '~> 0.3.6'
44
- # end
45
-
46
- platforms :ruby_19, :ruby_20 do
47
- gem 'yard-spellcheck', '~> 0.1.5'
48
- end
49
-
50
- platform :rbx do
51
- gem 'json', '~> 1.8.1'
52
- gem 'racc', '~> 1.4'
53
- gem 'rubysl-logger', '~> 2.0.0'
54
- gem 'rubysl-open-uri', '~> 2.0.0'
55
- gem 'rubysl-prettyprint', '~> 2.0.2'
56
- end
57
- end
58
-
59
- group :benchmarks do
60
- gem 'rbench', '~> 0.2.3'
61
- end
62
-
63
- platform :jruby do
64
- group :jruby do
65
- gem 'jruby-openssl', '~> 0.8.5'
66
- end
67
- end