mongomapper-versioned 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Versioned
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'active_support/core_ext/array/conversions'
2
2
  require 'mongomapper_id2'
3
+ require 'yajl'
3
4
 
4
5
  class Version
5
6
  include MongoMapper::Document
@@ -9,7 +10,7 @@ class Version
9
10
  key :doc, Hash
10
11
  key :created_at, Time
11
12
 
12
- before_create :set_created_at
13
+ before_create :set_created_at, :encode_doc
13
14
 
14
15
  belongs_to :versioned, polymorphic: true
15
16
  belongs_to :updater, polymorphic: true
@@ -76,4 +77,8 @@ class Version
76
77
  self.created_at = Time.now.utc
77
78
  end
78
79
  end
80
+
81
+ def encode_doc
82
+ self.doc = Yajl::Parser.new.parse(Yajl::Encoder.encode(self.doc))
83
+ end
79
84
  end
@@ -2,6 +2,7 @@ class User
2
2
  include MongoMapper::Document
3
3
 
4
4
  versioned
5
+ timestamps!
5
6
 
6
7
  key :name, String
7
8
  key :email, String
@@ -1,7 +1,10 @@
1
1
  require 'test_helper'
2
+ require 'active_support/time_with_zone'
3
+ require 'tzinfo'
2
4
 
3
5
  class VersioningTest < ActiveSupport::TestCase
4
6
  setup do
7
+ Time.zone = 'UTC'
5
8
  User.max_versions = nil
6
9
  @user = create_user
7
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongomapper-versioned
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000 Z
12
+ date: 2012-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: &70101954339260 !ruby/object:Gem::Requirement
15
+ name: yajl-ruby
16
+ requirement: &70249446340560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 3.1.0
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70101954339260
24
+ version_requirements: *70249446340560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bson_ext
27
- requirement: &70101954338680 !ruby/object:Gem::Requirement
27
+ requirement: &70249446336800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70101954338680
35
+ version_requirements: *70249446336800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mongo_mapper
38
- requirement: &70101954338080 !ruby/object:Gem::Requirement
38
+ requirement: &70249446353460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.10.1
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70101954338080
46
+ version_requirements: *70249446353460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mongomapper_id2
49
- requirement: &70101954337440 !ruby/object:Gem::Requirement
49
+ requirement: &70249446351740 !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: :runtime
56
56
  prerelease: false
57
- version_requirements: *70101954337440
57
+ version_requirements: *70249446351740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70101954336940 !ruby/object:Gem::Requirement
60
+ requirement: &70249446370360 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70101954336940
68
+ version_requirements: *70249446370360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: shoulda
71
- requirement: &70101954336500 !ruby/object:Gem::Requirement
71
+ requirement: &70249446365740 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70101954336500
79
+ version_requirements: *70249446365740
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ruby-debug19
82
- requirement: &70101954336020 !ruby/object:Gem::Requirement
82
+ requirement: &70249446385440 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,21 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70101954336020
90
+ version_requirements: *70249446385440
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: timecop
93
- requirement: &70101954335560 !ruby/object:Gem::Requirement
93
+ requirement: &70249446383680 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70249446383680
102
+ - !ruby/object:Gem::Dependency
103
+ name: tzinfo
104
+ requirement: &70249446381060 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,7 +109,7 @@ dependencies:
98
109
  version: '0'
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *70101954335560
112
+ version_requirements: *70249446381060
102
113
  description:
103
114
  email: alexkwolfe@gmail.com
104
115
  executables: []
@@ -135,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
146
  version: '0'
136
147
  segments:
137
148
  - 0
138
- hash: 1231796656342040495
149
+ hash: 1755080522254404046
139
150
  required_rubygems_version: !ruby/object:Gem::Requirement
140
151
  none: false
141
152
  requirements:
@@ -144,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
155
  version: '0'
145
156
  segments:
146
157
  - 0
147
- hash: 1231796656342040495
158
+ hash: 1755080522254404046
148
159
  requirements: []
149
160
  rubyforge_project:
150
161
  rubygems_version: 1.8.15