delayed_job_shallow_mongoid 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,15 @@
1
- = delayed_job_shallow_mongoid
1
+ delayed_job_shallow_mongoid
2
+ ===========================
2
3
 
3
4
  This library short-circuits serialization of [Mongoid](http://mongoid.org) model instances when a delayed job is called on them, or when they're passed as arguments to a delayed job. Rather than generate and store the fully-serialized YAML, a simple stub is stored. When the job is run, the stub is recognized and a `find` is done to look up the underlying document. If a referenced model isn't found at this point, the job simply does nothing.
4
5
 
5
- == Contributions
6
+ Contributions
7
+ -------------
6
8
 
7
9
  * Contributions encouraged. Feature branches appreciated.
8
10
  * Development generously supported by [Art.sy](http://art.sy).
9
11
 
10
- == Copyright
12
+ Copyright
13
+ ---------
11
14
 
12
15
  Copyright (c) 2011 Joey Aghion, Art.sy Inc. See LICENSE.txt for further details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -5,23 +5,23 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "delayed_job_shallow_mongoid"
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joey Aghion"]
12
- s.date = "2011-11-30"
12
+ s.date = "2011-12-19"
13
13
  s.description = "When the object or arg to a delayed_job is a Mongoid document, store only a small stub of the object instead of the full serialization."
14
14
  s.email = "joey@aghion.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  "Gemfile",
22
22
  "Gemfile.lock",
23
23
  "LICENSE.txt",
24
- "README.rdoc",
24
+ "README.md",
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "delayed_job_shallow_mongoid.gemspec",
@@ -1,7 +1,7 @@
1
1
  module Delayed
2
2
  module ShallowMongoid
3
3
  def self.dump(arg)
4
- if arg.is_a?(::Mongoid::Document)
4
+ if arg.is_a?(::Mongoid::Document) && !arg.embedded?
5
5
  ShallowMongoid::DocumentStub.new(arg.class, arg._id.to_s)
6
6
  else
7
7
  arg
@@ -2,6 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  class TestModel
4
4
  include ::Mongoid::Document
5
+ embeds_many :child_models
6
+ end
7
+
8
+ class ChildModel
9
+ include ::Mongoid::Document
10
+ embedded_in :test_model, inverse_of: :child_models
5
11
  end
6
12
 
7
13
  describe Delayed::ShallowMongoid::DocumentStub do
@@ -32,6 +38,12 @@ describe ::Delayed::PerformableMethod do
32
38
  method.args.first.should be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
33
39
  method.args.first.id.should == @model._id.to_s
34
40
  end
41
+ it "should not transform embedded document into shallow version" do
42
+ child = ChildModel.new
43
+ @model.child_models << child
44
+ method = ::Delayed::PerformableMethod.new(child, :to_s, [])
45
+ method.object.should_not be_a_kind_of(Delayed::ShallowMongoid::DocumentStub)
46
+ end
35
47
  end
36
48
 
37
49
  context 'when running job' do
@@ -3,7 +3,7 @@ require 'bundler/setup'
3
3
 
4
4
  require 'mail'
5
5
  require 'action_mailer'
6
- require 'delayed_job_mongoid'
6
+ require 'mongoid'
7
7
  require 'delayed_job_shallow_mongoid'
8
8
 
9
9
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_shallow_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
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: 2011-11-30 00:00:00.000000000Z
12
+ date: 2011-12-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: delayed_job
16
- requirement: &2165375160 !ruby/object:Gem::Requirement
16
+ requirement: &2157589320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2165375160
24
+ version_requirements: *2157589320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mongoid
27
- requirement: &2165374480 !ruby/object:Gem::Requirement
27
+ requirement: &2157588680 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.0.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2165374480
35
+ version_requirements: *2157588680
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: actionmailer
38
- requirement: &2165373820 !ruby/object:Gem::Requirement
38
+ requirement: &2157588060 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2165373820
46
+ version_requirements: *2157588060
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: shoulda
49
- requirement: &2165373180 !ruby/object:Gem::Requirement
49
+ requirement: &2157587500 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2165373180
57
+ version_requirements: *2157587500
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &2165372560 !ruby/object:Gem::Requirement
60
+ requirement: &2157586840 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2165372560
68
+ version_requirements: *2157586840
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &2165371940 !ruby/object:Gem::Requirement
71
+ requirement: &2157586280 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.6.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2165371940
79
+ version_requirements: *2157586280
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &2165371300 !ruby/object:Gem::Requirement
82
+ requirement: &2157585740 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *2165371300
90
+ version_requirements: *2157585740
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: ruby-debug19
93
- requirement: &2165370680 !ruby/object:Gem::Requirement
93
+ requirement: &2157585060 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2165370680
101
+ version_requirements: *2157585060
102
102
  description: When the object or arg to a delayed_job is a Mongoid document, store
103
103
  only a small stub of the object instead of the full serialization.
104
104
  email: joey@aghion.com
@@ -106,13 +106,13 @@ executables: []
106
106
  extensions: []
107
107
  extra_rdoc_files:
108
108
  - LICENSE.txt
109
- - README.rdoc
109
+ - README.md
110
110
  files:
111
111
  - .document
112
112
  - Gemfile
113
113
  - Gemfile.lock
114
114
  - LICENSE.txt
115
- - README.rdoc
115
+ - README.md
116
116
  - Rakefile
117
117
  - VERSION
118
118
  - delayed_job_shallow_mongoid.gemspec
@@ -138,7 +138,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: -2467168098406769091
141
+ hash: -3402765443251860913
142
142
  required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements: