mm-draft 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mongo_mapper/plugins/draft/draft.rb +8 -0
- data/lib/mongo_mapper/plugins/draft/version.rb +1 -1
- data/test/models/dog.rb +11 -0
- data/test/models/monkey.rb +1 -1
- data/test/unit/test_draft.rb +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73d13795e0d5e002fb08f837f432afd0b22d65c0
|
4
|
+
data.tar.gz: 1c978faf0f27857b7d14594879aed1b9d59ab8dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aecee7907f69b0128c836469d9fd44939922e7e8de5939115d18888aed82a3f395bfbabd438f7e4526918c6f56e28bf4c7245c4e3957e761f2601d9e9ec13046
|
7
|
+
data.tar.gz: 1452006b11cd9ed6c52734bef6bc563f31c32dea2b8297910267351baef83de44022dcf2ccf5a567499fd62238a67b16bd8917137ab922e35b3a0fcd6040bfc6
|
@@ -62,6 +62,14 @@ module MongoMapper
|
|
62
62
|
time_proc = lambda { Time.now.utc }
|
63
63
|
live_record.created_at = time_proc.call
|
64
64
|
end
|
65
|
+
|
66
|
+
if self.respond_to?("published_at")
|
67
|
+
time_proc = lambda { Time.now.utc }
|
68
|
+
tmp_time = time_proc.call
|
69
|
+
self.set(published_at: tmp_time)
|
70
|
+
live_record.published_at = tmp_time
|
71
|
+
end
|
72
|
+
|
65
73
|
live_record.draft_record_published_id = nil
|
66
74
|
live_record.draft = false
|
67
75
|
live_record.save!
|
data/test/models/dog.rb
ADDED
data/test/models/monkey.rb
CHANGED
data/test/unit/test_draft.rb
CHANGED
@@ -118,6 +118,19 @@ class DraftTest < Test::Unit::TestCase
|
|
118
118
|
|
119
119
|
|
120
120
|
end # context "draft monkey records" do
|
121
|
+
context "draft dog records with pubished_at" do
|
122
|
+
setup do
|
123
|
+
@monkey_1 = Dog.create(:name => "Chip")
|
124
|
+
end
|
125
|
+
|
126
|
+
should "should set published_at when publishing" do
|
127
|
+
@monkey_1.publish
|
128
|
+
@monkey_1.published_record.should_not == nil
|
129
|
+
@monkey_1.published_at.should_not == nil
|
130
|
+
@monkey_1.published_record.published_at.should_not == nil
|
131
|
+
@monkey_1.published_record.published_at.should == @monkey_1.published_at
|
132
|
+
end
|
133
|
+
end
|
121
134
|
|
122
135
|
# context "tree-record" do
|
123
136
|
# setup do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-draft
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leif Ringstad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/mongo_mapper/plugins/draft/draft.rb
|
55
55
|
- lib/mongo_mapper/plugins/draft/keys.rb
|
56
56
|
- lib/mongo_mapper/plugins/draft/version.rb
|
57
|
+
- test/models/dog.rb
|
57
58
|
- test/models/monkey.rb
|
58
59
|
- test/performance/models/monkey.rb
|
59
60
|
- test/performance/models/monkey_no_draft.rb
|
@@ -85,6 +86,7 @@ signing_key:
|
|
85
86
|
specification_version: 4
|
86
87
|
summary: A MongoMapper extension adding draft/publishing support
|
87
88
|
test_files:
|
89
|
+
- test/models/dog.rb
|
88
90
|
- test/models/monkey.rb
|
89
91
|
- test/test_helper.rb
|
90
92
|
- test/performance/performance_helper.rb
|