draftsman 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b38f2627f56beadc10e01b0a07b9484ba4fd9d92
4
- data.tar.gz: 98cefed36490f43ce3416ede00b2bfb1ef11b28d
3
+ metadata.gz: b6b70094474d8a0757c0b6dbf2eda0b44ad23a6c
4
+ data.tar.gz: efb35b92ed79310bf131ca6a662b65350500dc47
5
5
  SHA512:
6
- metadata.gz: 60d3bbe5dfb13262fc1075dc987726aaa671affda4c467360353d609722206ed86fadf0fff7c4a3351b4d4593a3cebf39f45e1fb4c9920ce30661d1e2d7d5dd5
7
- data.tar.gz: 3f8c96b231067ad01510a80a4c973ed594e7fc5f5d4069b2fa511774cae571d368becbf730e54c4a4f771166fef2513498febc64db05135340bfdaa2c831e61c
6
+ metadata.gz: 0387972bd595b8b5229f7ed2b72aa718b5a15245c1942b2197ef7a600d6a29c4e8c8d54af8ccb80c48371f0e927d5a52539fc9ec82be9715bcd79a2deeb4f473
7
+ data.tar.gz: 33a3fcf0f5abb3953231993d44edafed69efedd2379db307bde1a98ea1a1c65149275a5704af867cb16fe49c97969a0616af6c8851356e6ac8229f5ff663d374
@@ -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.4 (alpha)
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.
@@ -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'
@@ -1,3 +1,3 @@
1
1
  module Draftsman
2
- VERSION = '0.3.4'
2
+ VERSION = '0.3.5'
3
3
  end
@@ -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
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-05-21 00:00:00.000000000 Z
11
+ date: 2015-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord