govuk_content_models 35.0.0 → 35.0.1

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: 92694115f4161b92997ef39dda8faf21ffe830fa
4
- data.tar.gz: 16a4fc4c0c45804fe4d34ed799958f98e88d18ac
3
+ metadata.gz: 818153ae9ec98e66cebfcb9754ad00b7a447ffd4
4
+ data.tar.gz: e4f79124027a88b3353477a4a62853de0cc846e9
5
5
  SHA512:
6
- metadata.gz: dfae23fecd0faa01072c0ba78e24206d747fa9a2d0823b6cdd5de88c42798d973242651058209d4cd903ecc31dfae8b356c037284349a8974516e11d7487902f
7
- data.tar.gz: 304f70288d4261f7c5cd3ec21ecb2383c5dc6880b896df083df5e2df45a47bbb1286e8aa6d95c1e1c27445b6792d90a29d52bf0a0a17f77add414bb8ea88df09
6
+ metadata.gz: e5610c8661285a6a4f06889daa260e339db47318c6ecb3f3046a4f1c3f4a1e790581dfd59eb42c776a3cd8d8276cda9fd4c877111575ecf20546e965378d6922
7
+ data.tar.gz: 913527e1c41880a7a952271141656107a226d17056c2340f215f11f22e5a04970dbd85ef506e5e5235e818b177c1461759e484ae8565f8376862505a3870c5ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 35.0.1
4
+
5
+ - Handle saving changes to promotion toggles correctly for existing documents [#381](https://github.com/alphagov/govuk_content_models/pull/381)
6
+
3
7
  ## 35.0.0
4
8
 
5
9
  - Upgrade to Mongoid 5.1 and Rails 4.2
@@ -27,7 +27,10 @@ module PresentationToggles
27
27
  end
28
28
 
29
29
  def organ_donor_registration_key
30
- presentation_toggles['organ_donor_registration'] ||= self.class.default_presentation_toggles['organ_donor_registration']
30
+ unless presentation_toggles.key? 'organ_donor_registration'
31
+ presentation_toggles['organ_donor_registration'] = self.class.default_presentation_toggles['organ_donor_registration']
32
+ end
33
+ presentation_toggles['organ_donor_registration']
31
34
  end
32
35
 
33
36
  def promotion_choice=(value)
@@ -62,7 +65,10 @@ module PresentationToggles
62
65
  end
63
66
 
64
67
  def promotion_choice_key
65
- presentation_toggles['promotion_choice'] ||= self.class.default_presentation_toggles['promotion_choice']
68
+ unless presentation_toggles.key? 'promotion_choice'
69
+ presentation_toggles['promotion_choice'] = self.class.default_presentation_toggles['promotion_choice']
70
+ end
71
+ presentation_toggles['promotion_choice']
66
72
  end
67
73
 
68
74
  module ClassMethods
@@ -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 = "35.0.0"
3
+ VERSION = "35.0.1"
4
4
  end
@@ -81,6 +81,15 @@ class CompletedTransactionEditionTest < ActiveSupport::TestCase
81
81
  },
82
82
  }
83
83
  )
84
+ completed_transaction_edition.save(validate: false)
85
+ completed_transaction_edition.reload
86
+
87
+ completed_transaction_edition.promotion_choice = "register_to_vote"
88
+ completed_transaction_edition.promotion_choice_url = "https://www.gov.uk/register-to-vote"
89
+ completed_transaction_edition.save!
90
+
91
+ assert_equal "register_to_vote", completed_transaction_edition.reload.promotion_choice
92
+ assert_equal "https://www.gov.uk/register-to-vote", completed_transaction_edition.promotion_choice_url
84
93
 
85
94
  completed_transaction_edition.promotion_choice = "none"
86
95
  completed_transaction_edition.save!
@@ -93,13 +102,6 @@ class CompletedTransactionEditionTest < ActiveSupport::TestCase
93
102
 
94
103
  assert_equal "organ_donor", completed_transaction_edition.reload.promotion_choice
95
104
  assert_equal "https://www.organdonation.nhs.uk/registration/", completed_transaction_edition.promotion_choice_url
96
-
97
- completed_transaction_edition.promotion_choice = "register_to_vote"
98
- completed_transaction_edition.promotion_choice_url = "https://www.gov.uk/register-to-vote"
99
- completed_transaction_edition.save!
100
-
101
- assert_equal "register_to_vote", completed_transaction_edition.reload.promotion_choice
102
- assert_equal "https://www.gov.uk/register-to-vote", completed_transaction_edition.promotion_choice_url
103
105
  end
104
106
 
105
107
  test "passes through legacy organ donor info" do
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: 35.0.0
4
+ version: 35.0.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: 2016-04-25 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext