govuk_content_models 28.9.0 → 28.10.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 +4 -0
- data/app/models/downtime.rb +1 -1
- data/app/models/edition.rb +5 -0
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/downtime_test.rb +5 -4
- data/test/models/edition_test.rb +24 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/app/models/downtime.rb
CHANGED
data/app/models/edition.rb
CHANGED
|
@@ -210,6 +210,11 @@ class Edition
|
|
|
210
210
|
new_edition.body = whole_body
|
|
211
211
|
end
|
|
212
212
|
|
|
213
|
+
if edition_class == AnswerEdition and self.is_a?(LicenceEdition)
|
|
214
|
+
new_edition.body = whole_body
|
|
215
|
+
new_edition.overview = licence_overview
|
|
216
|
+
end
|
|
217
|
+
|
|
213
218
|
if edition_class == SimpleSmartAnswerEdition && %w(AnswerEdition GuideEdition ProgrammeEdition TransactionEdition).include?(self.class.name)
|
|
214
219
|
new_edition.body = whole_body
|
|
215
220
|
end
|
|
@@ -65,16 +65,17 @@ class DowntimeTest < ActiveSupport::TestCase
|
|
|
65
65
|
|
|
66
66
|
context "publicising downtime" do
|
|
67
67
|
should "start at midnight a day before it is scheduled" do
|
|
68
|
-
|
|
68
|
+
now = Time.zone.parse("2015-01-01")
|
|
69
|
+
Timecop.freeze(now) do
|
|
69
70
|
downtime = FactoryGirl.build(:downtime)
|
|
70
71
|
|
|
71
|
-
downtime.start_time =
|
|
72
|
+
downtime.start_time = Time.zone.parse("2015-01-02 03:00")
|
|
72
73
|
assert downtime.publicise?
|
|
73
74
|
|
|
74
|
-
downtime.start_time =
|
|
75
|
+
downtime.start_time = Time.zone.parse("2015-01-01 21:00")
|
|
75
76
|
assert downtime.publicise?
|
|
76
77
|
|
|
77
|
-
downtime.start_time =
|
|
78
|
+
downtime.start_time = Time.zone.parse("2015-01-03 00:00")
|
|
78
79
|
refute downtime.publicise?
|
|
79
80
|
end
|
|
80
81
|
end
|
data/test/models/edition_test.rb
CHANGED
|
@@ -222,6 +222,30 @@ class EditionTest < ActiveSupport::TestCase
|
|
|
222
222
|
assert_equal new_edition.whole_body, edition.whole_body
|
|
223
223
|
end
|
|
224
224
|
|
|
225
|
+
test "Cloning from LicenceEdition into AnswerEdition" do
|
|
226
|
+
edition = FactoryGirl.create(
|
|
227
|
+
:licence_edition,
|
|
228
|
+
state: "published",
|
|
229
|
+
panopticon_id: @artefact.id,
|
|
230
|
+
version_number: 1,
|
|
231
|
+
department: "Test dept",
|
|
232
|
+
licence_overview: "I am a test overview",
|
|
233
|
+
licence_identifier: "Test identifier",
|
|
234
|
+
licence_short_description: "I am a test short description",
|
|
235
|
+
will_continue_on: "test will continue on",
|
|
236
|
+
continuation_link: "https://github.com/alphagov/"
|
|
237
|
+
)
|
|
238
|
+
new_edition = edition.build_clone AnswerEdition
|
|
239
|
+
|
|
240
|
+
assert_equal AnswerEdition, new_edition.class
|
|
241
|
+
assert_equal 2, new_edition.version_number
|
|
242
|
+
assert_equal @artefact.id.to_s, new_edition.panopticon_id
|
|
243
|
+
assert_equal "draft", new_edition.state
|
|
244
|
+
assert_equal "Test dept", new_edition.department
|
|
245
|
+
assert_equal "I am a test overview", new_edition.overview
|
|
246
|
+
assert_equal edition.whole_body, new_edition.body
|
|
247
|
+
end
|
|
248
|
+
|
|
225
249
|
test "Cloning from ProgrammeEdition into AnswerEdition" do
|
|
226
250
|
edition = FactoryGirl.create(
|
|
227
251
|
:programme_edition,
|
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.
|
|
4
|
+
version: 28.10.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -478,7 +478,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
478
478
|
version: '0'
|
|
479
479
|
segments:
|
|
480
480
|
- 0
|
|
481
|
-
hash:
|
|
481
|
+
hash: -2559664419333283544
|
|
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:
|
|
490
|
+
hash: -2559664419333283544
|
|
491
491
|
requirements: []
|
|
492
492
|
rubyforge_project:
|
|
493
493
|
rubygems_version: 1.8.23
|