govuk_content_models 31.2.0 → 31.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/models/artefact.rb +2 -2
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/artefact_test.rb +15 -0
- 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: 976fcc12ec04b0a7730a917068999749e33235c4
|
4
|
+
data.tar.gz: 04559780e24de5c5ef77f2df19b0c5a1dbac2d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3cc2e23eca5a70c5acab04bc125d762813683f1442250dad71ef6d782a9b575f232b8f3cc5663cf4c242603fdc42bdce55691d7584ce54779224257d09cf79a
|
7
|
+
data.tar.gz: c645c2dfd2cbf17f8a8f49dad61462b03845a2f588a08d498a7a8e757e011da49c2879bb8def4f891337335c7e5b39c317e59536f16b2a79a5c9b2d9e2e47455
|
data/CHANGELOG.md
CHANGED
data/app/models/artefact.rb
CHANGED
@@ -294,7 +294,7 @@ class Artefact
|
|
294
294
|
if state == 'archived'
|
295
295
|
Edition.where(panopticon_id: self.id, :state.nin => ["archived"]).each do |edition|
|
296
296
|
edition.new_action(self, "note", comment: "Artefact has been archived. Archiving this edition.")
|
297
|
-
edition.archive!
|
297
|
+
edition.perform_event_without_validations(:archive!)
|
298
298
|
end
|
299
299
|
end
|
300
300
|
end
|
@@ -313,7 +313,7 @@ class Artefact
|
|
313
313
|
def save_as(user, options={})
|
314
314
|
default_action = new_record? ? "create" : "update"
|
315
315
|
action_type = options.delete(:action_type) || default_action
|
316
|
-
record_action
|
316
|
+
record_action(action_type, user: user)
|
317
317
|
save(options)
|
318
318
|
end
|
319
319
|
|
@@ -460,6 +460,21 @@ class ArtefactTest < ActiveSupport::TestCase
|
|
460
460
|
end
|
461
461
|
end
|
462
462
|
|
463
|
+
test "should not run validations on editions when archiving" do
|
464
|
+
artefact = FactoryGirl.create(:artefact, state: "live")
|
465
|
+
edition = FactoryGirl.create(:help_page_edition, panopticon_id: artefact.id, state: 'published')
|
466
|
+
user1 = FactoryGirl.create(:user)
|
467
|
+
|
468
|
+
# Make the edition invalid, check that it persisted the invalid state
|
469
|
+
edition.update_attribute(:title, nil)
|
470
|
+
assert_equal(nil, edition.reload.title)
|
471
|
+
|
472
|
+
artefact.update_attributes_as(user1, state: "archived")
|
473
|
+
artefact.save!
|
474
|
+
|
475
|
+
assert_equal("archived", edition.reload.state)
|
476
|
+
end
|
477
|
+
|
463
478
|
test "should restrict what attributes can be updated on an edition that has an archived artefact" do
|
464
479
|
artefact = FactoryGirl.create(:artefact, state: "live")
|
465
480
|
edition = FactoryGirl.create(:programme_edition, panopticon_id: artefact.id, state: "published")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_content_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 31.2.
|
4
|
+
version: 31.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Battley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bson_ext
|