mongoid_alize 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. data/config/locales/en.yml +10 -0
  2. data/lib/mongoid/alize/callback.rb +47 -3
  3. data/lib/mongoid/alize/callbacks/from/many.rb +6 -8
  4. data/lib/mongoid/alize/callbacks/from/one.rb +21 -9
  5. data/lib/mongoid/alize/callbacks/to/many_from_many.rb +2 -1
  6. data/lib/mongoid/alize/callbacks/to/many_from_one.rb +1 -1
  7. data/lib/mongoid/alize/callbacks/to/one_from_many.rb +1 -1
  8. data/lib/mongoid/alize/callbacks/to/one_from_one.rb +1 -1
  9. data/lib/mongoid/alize/errors/alize_error.rb +13 -0
  10. data/lib/mongoid/alize/errors/already_defined_field.rb +15 -0
  11. data/lib/mongoid/alize/errors/invalid_field.rb +15 -0
  12. data/lib/mongoid/alize/from_callback.rb +16 -3
  13. data/lib/mongoid/alize/to_callback.rb +29 -5
  14. data/lib/mongoid/alize/to_many_callback.rb +26 -21
  15. data/lib/mongoid/alize/to_one_callback.rb +2 -3
  16. data/lib/mongoid_alize.rb +6 -1
  17. data/spec/app/models/head.rb +4 -0
  18. data/spec/app/models/person.rb +3 -0
  19. data/spec/mongoid/alize/callback_spec.rb +46 -8
  20. data/spec/mongoid/alize/callbacks/from/many_spec.rb +92 -18
  21. data/spec/mongoid/alize/callbacks/from/one_spec.rb +106 -23
  22. data/spec/mongoid/alize/callbacks/to/many_from_many_spec.rb +9 -16
  23. data/spec/mongoid/alize/callbacks/to/many_from_one_spec.rb +8 -15
  24. data/spec/mongoid/alize/callbacks/to/one_from_many_spec.rb +14 -17
  25. data/spec/mongoid/alize/callbacks/to/one_from_one_spec.rb +12 -15
  26. data/spec/mongoid/alize/from_callback_spec.rb +44 -0
  27. data/spec/mongoid/alize/to_callback_spec.rb +74 -0
  28. data/spec/mongoid_alize_spec.rb +152 -16
  29. data/spec/spec_helper.rb +6 -0
  30. metadata +27 -21
data/spec/spec_helper.rb CHANGED
@@ -29,10 +29,16 @@ RSpec.configure do |config|
29
29
  [Head, Person].each do |klass|
30
30
  klass.reset_callbacks(:save)
31
31
  klass.reset_callbacks(:create)
32
+ klass.reset_callbacks(:destroy)
32
33
  klass.fields.reject! do |field, value|
33
34
  !(persistent_fields[klass] +
34
35
  persistent_fields[Object]).include?(field.to_sym)
35
36
  end
37
+ klass.instance_methods.each do |method|
38
+ if method =~ /^_?denormalize_/
39
+ klass.send(:undef_method, method)
40
+ end
41
+ end
36
42
  end
37
43
  end
38
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_alize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-05 00:00:00.000000000 Z
12
+ date: 2012-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: '2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: '2'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -49,32 +49,38 @@ executables: []
49
49
  extensions: []
50
50
  extra_rdoc_files: []
51
51
  files:
52
- - lib/mongoid/alize/macros.rb
53
- - lib/mongoid/alize/callbacks/to/one_from_many.rb
54
- - lib/mongoid/alize/callbacks/to/many_from_one.rb
55
- - lib/mongoid/alize/callbacks/to/many_from_many.rb
56
- - lib/mongoid/alize/callbacks/to/one_from_one.rb
52
+ - config/locales/en.yml
53
+ - lib/mongoid/alize/callback.rb
57
54
  - lib/mongoid/alize/callbacks/from/many.rb
58
55
  - lib/mongoid/alize/callbacks/from/one.rb
56
+ - lib/mongoid/alize/callbacks/to/many_from_many.rb
57
+ - lib/mongoid/alize/callbacks/to/many_from_one.rb
58
+ - lib/mongoid/alize/callbacks/to/one_from_many.rb
59
+ - lib/mongoid/alize/callbacks/to/one_from_one.rb
60
+ - lib/mongoid/alize/errors/alize_error.rb
61
+ - lib/mongoid/alize/errors/already_defined_field.rb
62
+ - lib/mongoid/alize/errors/invalid_field.rb
63
+ - lib/mongoid/alize/from_callback.rb
64
+ - lib/mongoid/alize/macros.rb
65
+ - lib/mongoid/alize/to_callback.rb
59
66
  - lib/mongoid/alize/to_many_callback.rb
60
67
  - lib/mongoid/alize/to_one_callback.rb
61
- - lib/mongoid/alize/to_callback.rb
62
- - lib/mongoid/alize/callback.rb
63
- - lib/mongoid/alize/from_callback.rb
64
68
  - lib/mongoid_alize.rb
65
- - spec/app/models/person.rb
66
69
  - spec/app/models/head.rb
70
+ - spec/app/models/person.rb
67
71
  - spec/helpers/macros_helper.rb
68
- - spec/mongoid_alize_spec.rb
69
- - spec/spec_helper.rb
72
+ - spec/mongoid/alize/callback_spec.rb
73
+ - spec/mongoid/alize/callbacks/from/many_spec.rb
74
+ - spec/mongoid/alize/callbacks/from/one_spec.rb
75
+ - spec/mongoid/alize/callbacks/to/many_from_many_spec.rb
70
76
  - spec/mongoid/alize/callbacks/to/many_from_one_spec.rb
71
77
  - spec/mongoid/alize/callbacks/to/one_from_many_spec.rb
72
78
  - spec/mongoid/alize/callbacks/to/one_from_one_spec.rb
73
- - spec/mongoid/alize/callbacks/to/many_from_many_spec.rb
74
- - spec/mongoid/alize/callbacks/from/one_spec.rb
75
- - spec/mongoid/alize/callbacks/from/many_spec.rb
79
+ - spec/mongoid/alize/from_callback_spec.rb
76
80
  - spec/mongoid/alize/macros_spec.rb
77
- - spec/mongoid/alize/callback_spec.rb
81
+ - spec/mongoid/alize/to_callback_spec.rb
82
+ - spec/mongoid_alize_spec.rb
83
+ - spec/spec_helper.rb
78
84
  homepage: https://github.com/dzello/mongoid_alize
79
85
  licenses: []
80
86
  post_install_message: