govuk_content_models 11.0.1 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,7 @@ class BusinessSupportEdition < Edition
|
|
28
28
|
field :support_types, type: Array, default: []
|
29
29
|
field :start_date, type: Date
|
30
30
|
field :end_date, type: Date
|
31
|
+
field :areas, type: Array, default: []
|
31
32
|
|
32
33
|
GOVSPEAK_FIELDS = Edition::GOVSPEAK_FIELDS + [:body, :eligibility, :evaluation, :additional_information]
|
33
34
|
|
@@ -39,8 +40,9 @@ class BusinessSupportEdition < Edition
|
|
39
40
|
|
40
41
|
@fields_to_clone = [:body, :min_value, :max_value, :max_employees, :organiser,
|
41
42
|
:eligibility, :evaluation, :additional_information, :continuation_link,
|
42
|
-
:will_continue_on, :contact_details, :short_description, :priority, :
|
43
|
-
:locations, :purposes, :sectors, :stages, :support_types,
|
43
|
+
:will_continue_on, :contact_details, :short_description, :priority, :areas,
|
44
|
+
:business_sizes, :locations, :purposes, :sectors, :stages, :support_types,
|
45
|
+
:start_date, :end_date]
|
44
46
|
|
45
47
|
scope :for_facets, lambda { |facets|
|
46
48
|
where({ "$and" => facets_criteria(facets) }).order_by([:priority, :desc], [:title, :asc])
|
@@ -22,6 +22,7 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
22
22
|
support.contact_details = "123 The Street, Townsville, UK. 07324 123456"
|
23
23
|
|
24
24
|
support.priority = 2
|
25
|
+
support.areas = ["123","345","45","9"]
|
25
26
|
support.business_sizes << "up-to-249"
|
26
27
|
support.business_types << "charity"
|
27
28
|
support.locations = ["scotland", "england"]
|
@@ -49,6 +50,8 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
49
50
|
assert_equal "123 The Street, Townsville, UK. 07324 123456", support.contact_details
|
50
51
|
|
51
52
|
assert_equal 2, support.priority
|
53
|
+
|
54
|
+
assert_equal ["123","345","45","9"], support.areas
|
52
55
|
assert_equal ["up-to-249"], support.business_sizes
|
53
56
|
assert_equal ["charity"], support.business_types
|
54
57
|
assert_equal ["scotland", "england"], support.locations
|
@@ -138,6 +141,7 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
138
141
|
:continuation_link => "http://www.gov.uk",
|
139
142
|
:contact_details => "Contact details to be cloned",
|
140
143
|
:priority => 2,
|
144
|
+
:areas => ['123','9999'],
|
141
145
|
:business_sizes => ['up-to-249'],
|
142
146
|
:locations => ['london'],
|
143
147
|
:purposes => ['start-up'],
|
@@ -163,6 +167,7 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
163
167
|
assert_equal support.contact_details, new_support.contact_details
|
164
168
|
|
165
169
|
assert_equal support.priority, new_support.priority
|
170
|
+
assert_equal support.areas, new_support.areas
|
166
171
|
assert_equal support.business_sizes, new_support.business_sizes
|
167
172
|
assert_equal support.locations, new_support.locations
|
168
173
|
assert_equal support.purposes, new_support.purposes
|
@@ -176,16 +181,19 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
176
181
|
context "for facets" do
|
177
182
|
setup do
|
178
183
|
@e1 = FactoryGirl.create(:business_support_edition,
|
184
|
+
:areas => ['2345', '1234'],
|
179
185
|
:business_sizes => ['1', 'up-to-1000000'],
|
180
186
|
:locations => ['narnia'], :purposes => ['world-domination'],
|
181
187
|
:sectors => ['agriculture', 'healthcare'],
|
182
188
|
:stages => ['pivoting'], :support_types => ['award', 'grant', 'loan'])
|
183
189
|
@e2 = FactoryGirl.create(:business_support_edition,
|
190
|
+
:areas => ['1212', '1234', '999'],
|
184
191
|
:business_sizes => ['1', 'up-to-1000000'],
|
185
192
|
:locations => ['hades', 'narnia'], :purposes => ['business-growth-and-expansion'],
|
186
193
|
:sectors => ['education', 'healthcare'],
|
187
194
|
:stages => ['start-up', 'pivoting'], :support_types => ['grant', 'loan', 'equity'])
|
188
195
|
@e3 = FactoryGirl.create(:business_support_edition,
|
196
|
+
:areas => ['1234'],
|
189
197
|
:business_sizes => ['up-to-249', 'up-to-1000000'],
|
190
198
|
:locations => ['hades', 'chicken-town'], :purposes => ['making-the-most-of-the-internet'],
|
191
199
|
:sectors => ['utilities'], :stages => ['start-up'], :support_types => ['grant'])
|
@@ -198,7 +206,7 @@ class BusinessSupportEditionTest < ActiveSupport::TestCase
|
|
198
206
|
assert_equal [@e1, @e2], editions
|
199
207
|
end
|
200
208
|
should "support searching with all the facet values" do
|
201
|
-
editions = BusinessSupportEdition.for_facets({:business_sizes => 'up-to-1000000', :locations => 'narnia,hades,chicken-town',
|
209
|
+
editions = BusinessSupportEdition.for_facets({:areas => '1234', :business_sizes => 'up-to-1000000', :locations => 'narnia,hades,chicken-town',
|
202
210
|
:purposes => 'business-growth-and-expansion,making-the-most-of-the-internet,world-domination',
|
203
211
|
:sectors => 'agriculture,healthcare,utilities', :stages => 'pivoting,start-up',
|
204
212
|
:support_types => 'award,grant,loan'})
|
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
|
4
|
+
version: 11.1.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-05-
|
12
|
+
date: 2014-05-30 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:
|
466
|
+
hash: 1779108246502469995
|
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:
|
475
|
+
hash: 1779108246502469995
|
476
476
|
requirements: []
|
477
477
|
rubyforge_project:
|
478
478
|
rubygems_version: 1.8.23
|