draftsman 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/draftsman/model.rb +1 -0
- data/lib/draftsman/version.rb +1 -1
- data/spec/models/skipper_spec.rb +50 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6b70094474d8a0757c0b6dbf2eda0b44ad23a6c
|
|
4
|
+
data.tar.gz: efb35b92ed79310bf131ca6a662b65350500dc47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0387972bd595b8b5229f7ed2b72aa718b5a15245c1942b2197ef7a600d6a29c4e8c8d54af8ccb80c48371f0e927d5a52539fc9ec82be9715bcd79a2deeb4f473
|
|
7
|
+
data.tar.gz: 33a3fcf0f5abb3953231993d44edafed69efedd2379db307bde1a98ea1a1c65149275a5704af867cb16fe49c97969a0616af6c8851356e6ac8229f5ff663d374
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.3.5 - July 12, 2015
|
|
4
|
+
|
|
5
|
+
- [@npafundi](https://github.com/npafundi)
|
|
6
|
+
[Fixed](https://github.com/liveeditor/draftsman/pull/29)
|
|
7
|
+
[#28](https://github.com/liveeditor/draftsman/issues/28) -
|
|
8
|
+
Skipped attributes aren't updated if a model has a draft
|
|
9
|
+
|
|
3
10
|
## 0.3.4 - May 21, 2015
|
|
4
11
|
|
|
5
12
|
- [@npafundi](https://github.com/npafundi)
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Draftsman v0.3.
|
|
1
|
+
# Draftsman v0.3.5 (alpha)
|
|
2
2
|
|
|
3
3
|
Draftsman is a Ruby gem that lets you create draft versions of your database records. If you're developing a system in
|
|
4
4
|
need of simple drafts or a publishing approval queue, then Draftsman just might be what you need.
|
data/lib/draftsman/model.rb
CHANGED
|
@@ -313,6 +313,7 @@ module Draftsman
|
|
|
313
313
|
if send(self.class.draft_association_name).present?
|
|
314
314
|
data[:object_changes] = changes_for_draftsman if track_object_changes_for_draft?
|
|
315
315
|
send(self.class.draft_association_name).update_attributes data
|
|
316
|
+
update_skipped_attributes
|
|
316
317
|
# If there's not draft, create an update draft.
|
|
317
318
|
else
|
|
318
319
|
data[:event] = 'update'
|
data/lib/draftsman/version.rb
CHANGED
data/spec/models/skipper_spec.rb
CHANGED
|
@@ -215,7 +215,7 @@ describe Skipper do
|
|
|
215
215
|
skipper.attributes = skipper.draft.reify.attributes
|
|
216
216
|
end
|
|
217
217
|
|
|
218
|
-
context 'with changes' do
|
|
218
|
+
context 'with changes to drafted attribute' do
|
|
219
219
|
before { skipper.name = 'Steve' }
|
|
220
220
|
|
|
221
221
|
it 'is persisted' do
|
|
@@ -255,6 +255,55 @@ describe Skipper do
|
|
|
255
255
|
end
|
|
256
256
|
end
|
|
257
257
|
|
|
258
|
+
context 'with changes to skipped attributes' do
|
|
259
|
+
before do
|
|
260
|
+
skipper.skip_me = 'Skip and save'
|
|
261
|
+
skipper.draft_update
|
|
262
|
+
skipper.reload
|
|
263
|
+
skipper.attributes = skipper.draft.reify.attributes
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
it 'is persisted' do
|
|
267
|
+
expect(subject).to be_persisted
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
it 'is a draft' do
|
|
271
|
+
expect(subject.draft?).to eql true
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
it 'has a `draft_id`' do
|
|
275
|
+
expect(subject.draft_id).to be_present
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
it 'has a `draft`' do
|
|
279
|
+
expect(subject.draft).to be_present
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
it 'has an `update` draft' do
|
|
283
|
+
expect(subject.draft.update?).to eql true
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
it 'has the original `name`' do
|
|
287
|
+
expect(subject.name).to eql 'Bob'
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
it "updates skipped attribute's value" do
|
|
291
|
+
expect(subject.skip_me).to eql 'Skip and save'
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
it 'updates the existing draft' do
|
|
295
|
+
expect { subject }.to_not change(Draftsman::Draft.where(:id => skipper.draft_id), :count)
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
it "keeps the draft's `name`" do
|
|
299
|
+
expect(subject.draft.reify.name).to eql 'Sam'
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
it 'updates skipped attribute on draft' do
|
|
303
|
+
expect(subject.draft.reify.skip_me).to eql 'Skip and save'
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
258
307
|
context 'with no changes' do
|
|
259
308
|
it 'is persisted' do
|
|
260
309
|
expect(subject).to be_persisted
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: draftsman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Peters
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|