govuk_content_models 28.8.0 → 28.9.0

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
+ ## 28.9.0
2
+
3
+ - Add `department_analytics_profile` to transaction editions
4
+
1
5
  ## 28.8.0
2
6
 
3
7
  - Add `redirect_url` to artefact
@@ -6,13 +6,16 @@ class TransactionEdition < Edition
6
6
  field :link, type: String
7
7
  field :more_information, type: String
8
8
  field :need_to_know, type: String
9
+ field :department_analytics_profile, type: String
9
10
  field :alternate_methods, type: String
10
11
 
11
12
  GOVSPEAK_FIELDS = [:introduction, :more_information, :alternate_methods, :need_to_know]
12
13
 
14
+ validates_format_of :department_analytics_profile, with: /UA-\d+-\d+/i, allow_blank: true
15
+
13
16
  @fields_to_clone = [:introduction, :will_continue_on, :link,
14
17
  :more_information, :alternate_methods,
15
- :need_to_know]
18
+ :need_to_know, :department_analytics_profile]
16
19
 
17
20
  def indexable_content
18
21
  "#{super} #{Govspeak::Document.new(introduction).to_text} #{Govspeak::Document.new(more_information).to_text}".strip
@@ -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 = "28.8.0"
3
+ VERSION = "28.9.0"
4
4
  end
@@ -6,6 +6,22 @@ class TransactionEditionTest < ActiveSupport::TestCase
6
6
  @artefact = FactoryGirl.create(:artefact)
7
7
  end
8
8
 
9
+ context 'Department analytics profiles' do
10
+ should "only allow valid Google Analytics profiles" do
11
+ transaction = FactoryGirl.create(:transaction_edition, panopticon_id: @artefact.id)
12
+
13
+ ['invalid', 'ua-12345', 'UA-1234A-1'].each do |id|
14
+ transaction.department_analytics_profile = id
15
+ refute transaction.valid?
16
+ end
17
+
18
+ ['ua-123456-1', 'UA-00-10'].each do |id|
19
+ transaction.department_analytics_profile = id
20
+ assert transaction.valid?
21
+ end
22
+ end
23
+ end
24
+
9
25
  context "indexable_content" do
10
26
  should "include the introduction without markup" do
11
27
  transaction = FactoryGirl.create(:transaction_edition, introduction: "## introduction", more_information: "", panopticon_id: @artefact.id)
@@ -17,4 +33,4 @@ class TransactionEditionTest < ActiveSupport::TestCase
17
33
  assert_equal "more info", transaction.indexable_content
18
34
  end
19
35
  end
20
- end
36
+ end
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: 28.8.0
4
+ version: 28.9.0
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: 2015-07-13 00:00:00.000000000 Z
12
+ date: 2015-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -478,7 +478,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
478
478
  version: '0'
479
479
  segments:
480
480
  - 0
481
- hash: -3441532495869852238
481
+ hash: 1058733526370502898
482
482
  required_rubygems_version: !ruby/object:Gem::Requirement
483
483
  none: false
484
484
  requirements:
@@ -487,7 +487,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
487
487
  version: '0'
488
488
  segments:
489
489
  - 0
490
- hash: -3441532495869852238
490
+ hash: 1058733526370502898
491
491
  requirements: []
492
492
  rubyforge_project:
493
493
  rubygems_version: 1.8.23