govuk_content_models 11.0.0 → 11.0.1

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 11.0.1
2
+
3
+ * Destroyng an edition lets siblings know
4
+
1
5
  ## 11.0.0
2
6
 
3
7
  * Remove fact check logic from the `Edition` model, since it only belongs in
@@ -9,6 +9,7 @@ module Workflow
9
9
  included do
10
10
  validate :not_editing_published_item
11
11
  before_destroy :check_can_delete_and_notify
12
+ after_destroy :notify_siblings_of_published_edition
12
13
 
13
14
  before_save :denormalise_users
14
15
  after_create :notify_siblings_of_new_edition
@@ -1,4 +1,4 @@
1
1
  module GovukContentModels
2
2
  # Changing this causes Jenkins to tag and release the gem into the wild
3
- VERSION = "11.0.0"
3
+ VERSION = "11.0.1"
4
4
  end
@@ -473,6 +473,34 @@ class EditionTest < ActiveSupport::TestCase
473
473
  assert_nil loaded_answer
474
474
  end
475
475
 
476
+ test "deleting a newer draft of a published edition removes sibling information" do
477
+ user1 = FactoryGirl.create(:user)
478
+ edition = AnswerEdition.find_or_create_from_panopticon_data(@artefact.id, user1, {})
479
+ edition.update_attribute(:state, "published")
480
+ second_edition = edition.build_clone
481
+ second_edition.save!
482
+ edition.reload
483
+
484
+ assert edition.sibling_in_progress
485
+
486
+ second_edition.destroy
487
+ edition.reload
488
+
489
+ assert_nil edition.sibling_in_progress
490
+ end
491
+
492
+ test "the latest edition should remove sibling_in_progress details if it is present" do
493
+ user1 = FactoryGirl.create(:user)
494
+ edition = AnswerEdition.find_or_create_from_panopticon_data(@artefact.id, user1, {})
495
+ edition.update_attribute(:state, "published")
496
+
497
+ # simulate a document having a newer edition destroyed (previous behaviour).
498
+ edition.sibling_in_progress = 2
499
+ edition.save(validate: false)
500
+
501
+ assert edition.can_create_new_edition?
502
+ end
503
+
476
504
  test "should also delete associated artefact" do
477
505
 
478
506
  FactoryGirl.create(:tag, tag_id: "test-section", title: "Test section", tag_type: "section")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_content_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.0
4
+ version: 11.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-19 00:00:00.000000000 Z
12
+ date: 2014-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -463,7 +463,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
463
463
  version: '0'
464
464
  segments:
465
465
  - 0
466
- hash: -2782953638830349202
466
+ hash: -1368179395246728508
467
467
  required_rubygems_version: !ruby/object:Gem::Requirement
468
468
  none: false
469
469
  requirements:
@@ -472,7 +472,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
472
472
  version: '0'
473
473
  segments:
474
474
  - 0
475
- hash: -2782953638830349202
475
+ hash: -1368179395246728508
476
476
  requirements: []
477
477
  rubyforge_project:
478
478
  rubygems_version: 1.8.23