govuk_content_models 38.0.0 → 39.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5df2ae51cb9c82fd594961e0d80a96d6ebe6bc0c
4
- data.tar.gz: 48f4278dd4f2cea25927987c2e73beaf078274d1
3
+ metadata.gz: 57de0bfc9ffd58f24eea2a4f1bb0b21e13971ad5
4
+ data.tar.gz: 2802a90194fefafe9fa6944628aed782b6a44708
5
5
  SHA512:
6
- metadata.gz: 086b090dfd1932c064b6ae360b84df33aead4ad44bd2ee4c4a107726c18db158553e872a65061d65544e7c89e7598b1b3f81caee933ab2d25967691c4ae7ce1d
7
- data.tar.gz: 477ea838b3c2522868a69729af1ed696348890498233745563388d5ec77368d209e2d2cb4357b51c40cefc796b28f5b55a3acf0c985e049e4e589bcc3576e2ad
6
+ metadata.gz: cb545e782d6933007549e905217de3fb32df9b956f63d555560c42022223281f4bad8cd2d13580b45e98ec8b82ee20372c66a071dd76b030f86fdaf9c36ef212
7
+ data.tar.gz: 9f2f24e465e2af95a6b261c589ee16db0080bd43a9b97ea0cb5d46a72a63782f9a1e13980123a7f40300eb9462787cd163f3b31fc9260c127ef24a7342bf64f3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 39.0.0
4
+
5
+ - Removed LocalAuthority model as this information is now obtained from Local Links Manager [#391](https://github.com/alphagov/govuk_content_models/pull/391)
6
+
3
7
  ## 38.0.0
4
8
 
5
9
  - Removed LocalInteraction model as this information is now obtained from Local
@@ -1,5 +1,4 @@
1
1
  require "csv"
2
- require "local_authority"
3
2
  require "safe_html"
4
3
 
5
4
  class LocalService
@@ -18,23 +17,4 @@ class LocalService
18
17
  def self.find_by_lgsl_code(lgsl_code)
19
18
  LocalService.where(lgsl_code: lgsl_code).first
20
19
  end
21
-
22
- def preferred_provider(snac_or_snac_list)
23
- snac_list = [*snac_or_snac_list]
24
- providers = LocalAuthority.for_snacs(snac_list)
25
- select_tier(providers)
26
- end
27
-
28
- def provided_by
29
- LocalAuthority.any_in(tier: providing_tier)
30
- end
31
-
32
- private
33
-
34
- def select_tier(authorities)
35
- by_tier = Hash[authorities.map {|a| [a.tier, a]}]
36
- tier = providing_tier.find { |t| by_tier.has_key?(t) }
37
- tier && by_tier[tier]
38
- end
39
-
40
20
  end
@@ -30,11 +30,6 @@ class LocalTransactionEdition < Edition
30
30
  LocalService.find_by_lgsl_code(lgsl_code)
31
31
  end
32
32
 
33
- def service_provided_by?(snac)
34
- authority = LocalAuthority.find_by_snac(snac)
35
- authority && service.provided_by.include?(authority)
36
- end
37
-
38
33
  def whole_body
39
34
  self.introduction
40
35
  end
@@ -1,16 +1,5 @@
1
1
  module LocalServicesHelper
2
- def make_authority(tier, options)
3
- authority = FactoryGirl.create(:local_authority,
4
- snac: options[:snac], tier: tier)
5
- authority
6
- end
7
-
8
2
  def make_service(lgsl_code, providing_tier)
9
3
  LocalService.create!(lgsl_code: lgsl_code, providing_tier: providing_tier)
10
4
  end
11
-
12
- def make_authority_providing(_lgsl_code, tier = 'county')
13
- council = FactoryGirl.create(:local_authority, snac: "00AA", tier: tier)
14
- council
15
- end
16
5
  end
@@ -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 = "38.0.0"
3
+ VERSION = "39.0.0"
4
4
  end
@@ -3,85 +3,4 @@ require "govuk_content_models/test_helpers/local_services"
3
3
 
4
4
  class LocalServiceTest < ActiveSupport::TestCase
5
5
  include LocalServicesHelper
6
-
7
- def create_service_for_tiers(*tiers)
8
- @service = LocalService.create!(
9
- lgsl_code: @lgsl_code,
10
- providing_tier: tiers.map(&:to_s)
11
- )
12
- end
13
-
14
- def setup
15
- LocalAuthority.delete_all
16
- @lgsl_code = 123
17
- @snac_code = "AA00"
18
- @county_council = FactoryGirl.create(
19
- :local_authority,
20
- tier: "county",
21
- snac: "AA00"
22
- )
23
- @district_council = FactoryGirl.create(
24
- :local_authority,
25
- tier: "district",
26
- snac: "AA"
27
- )
28
- @unitary_authority = FactoryGirl.create(
29
- :local_authority,
30
- tier: "unitary",
31
- snac: "BB00"
32
- )
33
- end
34
-
35
- test "should not list a county as providing a service for districts" do
36
- service = create_service_for_tiers(:district, :unitary)
37
-
38
- refute_includes service.provided_by.map(&:snac), @county_council.snac
39
- end
40
-
41
- test "should not list a district as providing a service for counties" do
42
- service = create_service_for_tiers(:county, :unitary)
43
-
44
- refute_includes service.provided_by.map(&:snac), @district_council.snac
45
- end
46
-
47
- test "should list a county as providing a service for counties and unitaries" do
48
- service = create_service_for_tiers(:county, :unitary)
49
-
50
- assert_includes service.provided_by.map(&:snac), @county_council.snac
51
- end
52
-
53
- test "should list a district as providing a service for districts and unitaries" do
54
- service = create_service_for_tiers(:district, :unitary)
55
-
56
- assert_includes service.provided_by.map(&:snac), @district_council.snac
57
- end
58
-
59
- test "should list a UA as providing a service for counties and unitaries" do
60
- service = create_service_for_tiers(:county, :unitary)
61
-
62
- assert_includes service.provided_by.map(&:snac), @unitary_authority.snac
63
- end
64
-
65
- test "should list a UA as providing a service for districts and unitaries" do
66
- service = create_service_for_tiers(:county, :unitary)
67
-
68
- assert_includes service.provided_by.map(&:snac), @unitary_authority.snac
69
- end
70
-
71
- test "should list only districts and UAs as providers" do
72
- service = create_service_for_tiers(:district, :unitary)
73
- providers = service.provided_by
74
- assert_equal 2, providers.length
75
- assert_includes providers.map(&:snac), @district_council.snac
76
- assert_includes providers.map(&:snac), @unitary_authority.snac
77
- end
78
-
79
- test "should list all authorities providing a both-tier service" do
80
- service = create_service_for_tiers("district", "unitary", "county")
81
- make_authority("county", snac: "CC00", lgsl: 124)
82
- providers = service.provided_by
83
- assert_includes providers.map(&:snac), @district_council.snac
84
- assert_includes providers.map(&:snac), @unitary_authority.snac
85
- assert_includes providers.map(&:snac), @county_council.snac
86
- end
87
6
  end
@@ -11,40 +11,6 @@ class LocalTransactionEditionTest < ActiveSupport::TestCase
11
11
  @artefact = FactoryGirl.create(:artefact)
12
12
  end
13
13
 
14
- test "should report that an authority provides a service if the snac references a real authority in the same tier" do
15
- bins_transaction = LocalTransactionEdition.new(
16
- lgsl_code: BINS,
17
- title: "Transaction",
18
- slug: "slug",
19
- panopticon_id: @artefact.id
20
- )
21
- make_service(BINS, %w(county unitary))
22
- county_council = make_authority('county', snac: '00PP')
23
- assert bins_transaction.service_provided_by?(county_council.snac)
24
- end
25
-
26
- test "should report that an authority does not provide a service if the snac does not reference a real authority" do
27
- bins_transaction = LocalTransactionEdition.new(
28
- lgsl_code: BINS,
29
- title: "Transaction",
30
- slug: "slug",
31
- panopticon_id: @artefact.id
32
- )
33
- refute bins_transaction.service_provided_by?('No-Such-SNAC')
34
- end
35
-
36
- test "should report that an authority does not provide a service if the snac references a real authority in the wrong tier" do
37
- bins_transaction = LocalTransactionEdition.new(
38
- lgsl_code: BINS,
39
- title: "Transaction",
40
- slug: "slug",
41
- panopticon_id: @artefact.id
42
- )
43
- make_service(BINS, %w(district unitary))
44
- county_council = make_authority('county', snac: '00ZZ')
45
- refute bins_transaction.service_provided_by?(county_council.snac)
46
- end
47
-
48
14
  test "should be a transaction search format" do
49
15
  bins_transaction = LocalTransactionEdition.new(
50
16
  lgsl_code: BINS,
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: 38.0.0
4
+ version: 39.0.0
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-08-08 00:00:00.000000000 Z
11
+ date: 2016-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bson_ext
@@ -341,7 +341,6 @@ files:
341
341
  - app/models/guide_edition.rb
342
342
  - app/models/help_page_edition.rb
343
343
  - app/models/licence_edition.rb
344
- - app/models/local_authority.rb
345
344
  - app/models/local_service.rb
346
345
  - app/models/local_transaction_edition.rb
347
346
  - app/models/overview_dashboard.rb
@@ -422,7 +421,6 @@ files:
422
421
  - test/models/edition_test.rb
423
422
  - test/models/help_page_edition_test.rb
424
423
  - test/models/licence_edition_test.rb
425
- - test/models/local_authority_test.rb
426
424
  - test/models/local_service_test.rb
427
425
  - test/models/local_transaction_edition_test.rb
428
426
  - test/models/overview_dashboard_test.rb
@@ -496,7 +494,6 @@ test_files:
496
494
  - test/models/edition_test.rb
497
495
  - test/models/help_page_edition_test.rb
498
496
  - test/models/licence_edition_test.rb
499
- - test/models/local_authority_test.rb
500
497
  - test/models/local_service_test.rb
501
498
  - test/models/local_transaction_edition_test.rb
502
499
  - test/models/overview_dashboard_test.rb
@@ -1,22 +0,0 @@
1
- require "csv"
2
- require "safe_html"
3
-
4
- class LocalAuthority
5
- include Mongoid::Document
6
-
7
- field :name, type: String
8
- field :snac, type: String
9
- field :local_directgov_id, type: Integer
10
- field :tier, type: String
11
- field :homepage_url, type: String
12
-
13
- validates_uniqueness_of :snac
14
- validates_presence_of :snac, :local_directgov_id, :name, :tier
15
-
16
- scope :for_snacs, ->(snacs) { any_in(snac: snacs) }
17
-
18
- def self.find_by_snac(snac)
19
- for_snacs([snac]).first
20
- end
21
-
22
- end
@@ -1,24 +0,0 @@
1
- require_relative "../test_helper"
2
-
3
- describe LocalAuthority do
4
- before :each do
5
- LocalAuthority.delete_all
6
- end
7
-
8
- it "should create an authority with correct field types" do
9
- # Although it may seem overboard, this test is helpful to confirm
10
- # the correct field types are being used on the model
11
- LocalAuthority.create!(
12
- name: "Example",
13
- snac: "AA00",
14
- local_directgov_id: 1,
15
- tier: "county",
16
- homepage_url: 'http://example.gov/')
17
- authority = LocalAuthority.first
18
- assert_equal "Example", authority.name
19
- assert_equal "AA00", authority.snac
20
- assert_equal 1, authority.local_directgov_id
21
- assert_equal "county", authority.tier
22
- assert_equal "http://example.gov/", authority.homepage_url
23
- end
24
- end