govuk_content_models 8.10.0 → 9.0.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
+ ## 9.0.0
2
+
3
+ * Removes `business_support_identifier` field from BusinessSupportEdition.
4
+
1
5
  ## 8.10.0
2
6
 
3
7
  * Adds a flag to `attaches` to have the `Attachable`
@@ -17,7 +17,6 @@ class BusinessSupportEdition < Edition
17
17
  field :continuation_link, type: String
18
18
  field :will_continue_on, type: String
19
19
  field :contact_details, type: String
20
- field :business_support_identifier, type: String
21
20
 
22
21
  field :priority, type: Integer, default: 1
23
22
  field :business_types, type: Array, default: []
@@ -30,13 +29,9 @@ class BusinessSupportEdition < Edition
30
29
  field :start_date, type: Date
31
30
  field :end_date, type: Date
32
31
 
33
- index :business_support_identifier
34
-
35
32
  GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:body, :eligibility, :evaluation, :additional_information]
36
33
 
37
34
  validate :min_must_be_less_than_max
38
- validates :business_support_identifier, :presence => true
39
- validate :business_support_identifier_unique
40
35
  validates_format_of :continuation_link, :with => URI::regexp(%w(http https)), :allow_blank => true
41
36
 
42
37
  # https://github.com/mongoid/mongoid/issues/1735 Really Mongoid‽
@@ -44,10 +39,8 @@ class BusinessSupportEdition < Edition
44
39
 
45
40
  @fields_to_clone = [:body, :min_value, :max_value, :max_employees, :organiser,
46
41
  :eligibility, :evaluation, :additional_information, :continuation_link,
47
- :will_continue_on, :contact_details, :short_description,
48
- :business_support_identifier, :priority, :business_sizes,
49
- :locations, :purposes, :sectors, :stages, :support_types,
50
- :start_date, :end_date]
42
+ :will_continue_on, :contact_details, :short_description, :priority, :business_sizes,
43
+ :locations, :purposes, :sectors, :stages, :support_types, :start_date, :end_date]
51
44
 
52
45
  scope :for_facets, lambda { |facets|
53
46
  where({ "$and" => facets_criteria(facets) }).order_by([:priority, :desc], [:title, :asc])
@@ -67,13 +60,6 @@ class BusinessSupportEdition < Edition
67
60
  end
68
61
  end
69
62
 
70
- def business_support_identifier_unique
71
- if self.class.without_state('archived').where(:business_support_identifier => business_support_identifier,
72
- :panopticon_id.ne => panopticon_id).any?
73
- errors.add(:business_support_identifier, :taken)
74
- end
75
- end
76
-
77
63
  def self.facets_criteria(facets)
78
64
  criteria = []
79
65
  facets.each do |facet_name, values|
@@ -107,7 +107,6 @@ FactoryGirl.define do
107
107
  end
108
108
 
109
109
  factory :business_support_edition, :parent => :edition, :class => "BusinessSupportEdition" do
110
- sequence(:business_support_identifier) {|n| "identifier-#{n}" }
111
110
  end
112
111
 
113
112
  factory :guide_edition do |ge|
@@ -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 = "8.10.0"
3
+ VERSION = "9.0.0"
4
4
  end
@@ -20,7 +20,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
20
20
  support.continuation_link = "http://www.gov.uk"
21
21
  support.will_continue_on = "The GOVUK website"
22
22
  support.contact_details = "123 The Street, Townsville, UK. 07324 123456"
23
- support.business_support_identifier = "123-4-5"
24
23
 
25
24
  support.priority = 2
26
25
  support.business_sizes << "up-to-249"
@@ -48,7 +47,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
48
47
  assert_equal "http://www.gov.uk", support.continuation_link
49
48
  assert_equal "The GOVUK website", support.will_continue_on
50
49
  assert_equal "123 The Street, Townsville, UK. 07324 123456", support.contact_details
51
- assert_equal "123-4-5", support.business_support_identifier
52
50
 
53
51
  assert_equal 2, support.priority
54
52
  assert_equal ["up-to-249"], support.business_sizes
@@ -70,33 +68,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
70
68
  refute support.valid?
71
69
  end
72
70
 
73
- should "require a business_support_identifier" do
74
- support = FactoryGirl.build(:business_support_edition, :business_support_identifier => '')
75
- assert ! support.valid?, "expected business support edition not to be valid"
76
- end
77
-
78
- context "business support identifier uniqueness" do
79
- setup do
80
- @support = FactoryGirl.build(:business_support_edition, panopticon_id: @artefact.id)
81
- @another_artefact = FactoryGirl.create(:artefact)
82
- end
83
- should "have a unique business support identifier" do
84
- another_support = FactoryGirl.create(:business_support_edition, panopticon_id: @another_artefact.id,
85
- :business_support_identifier => "this-should-be-unique")
86
- @support.business_support_identifier = "this-should-be-unique"
87
- assert !@support.valid?, "business_support_identifier should be unique"
88
- @support.business_support_identifier = "this-is-different"
89
- assert @support.valid?, "business_support_identifier should be unique"
90
- end
91
-
92
- should "not consider archived editions when evaluating uniqueness" do
93
- another_support = FactoryGirl.create(:business_support_edition, panopticon_id: @another_artefact.id,
94
- :business_support_identifier => "this-should-be-unique", :state => "archived")
95
- @support.business_support_identifier = "this-should-be-unique"
96
- assert @support.valid?, "business_support should be valid"
97
- end
98
- end
99
-
100
71
  context "numeric field validations" do
101
72
  # https://github.com/mongoid/mongoid/issues/1735 Really Mongoid‽
102
73
  [
@@ -154,7 +125,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
154
125
  support = FactoryGirl.create(:business_support_edition,
155
126
  :panopticon_id => @artefact.id,
156
127
  :state => "published",
157
- :business_support_identifier => "1234",
158
128
  :short_description => "Short description of support format",
159
129
  :body => "Body to be cloned",
160
130
  :min_value => 1,
@@ -179,7 +149,6 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
179
149
 
180
150
  new_support = support.build_clone
181
151
 
182
- assert_equal support.business_support_identifier, new_support.business_support_identifier
183
152
  assert_equal support.short_description, new_support.short_description
184
153
  assert_equal support.body, new_support.body
185
154
  assert_equal support.min_value, new_support.min_value
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: 8.10.0
4
+ version: 9.0.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: 2014-03-21 00:00:00.000000000 Z
12
+ date: 2014-03-27 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: -2794998033139020622
466
+ hash: 2687494415806384648
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: -2794998033139020622
475
+ hash: 2687494415806384648
476
476
  requirements: []
477
477
  rubyforge_project:
478
478
  rubygems_version: 1.8.23