pugin 1.6.10 → 1.6.11

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: 598f13c1c484ebd41c4063e2eca63815d9354db0
4
- data.tar.gz: 635c83954dd9a9757a3d357e042aaeaee79b9fbb
3
+ metadata.gz: 5f61fc187179831aa8db8dfc5aaef380882dd060
4
+ data.tar.gz: f3aed9148a2d6588cc13b1311b832fdc496ee824
5
5
  SHA512:
6
- metadata.gz: 1dc29556f5b6a8a0f1419b4bb71dbe93bafb9e75c6ff443d27a96b6b13a3a3946606fa2029d9f547521a34bfbbfbfda2c9cb7d62b1be8d7b2de27ce7c33dcdc8
7
- data.tar.gz: 880812ef674ffaeaf5c5dc8fcbb76291d8fc14b9cf324eef1d5d4b44d970c98fa133a8e4c17a70f37e146015c670db8c7dd020f627f139ef9d007540a17b0ebc
6
+ metadata.gz: 29a52f53eee2aedaf4be4419c945b07d2d80cef5ada613bc6ca3a5befca277492a49c3283ebdac6caccf3e90c277bcfadecede619d04535e841edd5a603bba48
7
+ data.tar.gz: 9e054e42746e1ab1ef5364722aec08bb1d2b4303bcc2eaa7ad351215d157c82a10b7fb9206a2591ad1eb7abda0c6fcf73f09ab1a11d34ab519220513290d3f91
@@ -1,4 +1,4 @@
1
- %svg{"data-icon" => "close", :focusable => "false", :height => "20", :viewbox => "0 0 20 20", :width => "20", :xmlns => "http://www.w3.org/2000/svg"}
1
+ %svg{ width: '20', height: '20', viewbox: '0 0 20 20', xmlns: 'http://www.w3.org/2000/svg', aria:{ hidden: 'true' }, data:{ icon: 'close' } }
2
2
  %title Cross
3
3
  %g{:stroke => "#fff"}
4
4
  %g
@@ -1,4 +1,4 @@
1
- %svg{ width: '38', height: '50', viewbox: '0 0 38 50', focusable: 'false', xmlns: 'http://www.w3.org/2000/svg' }
1
+ %svg{ width: '38', height: '50', viewbox: '0 0 38 50', xmlns: 'http://www.w3.org/2000/svg', aria:{ hidden: 'true' } }
2
2
  %title Download icon
3
3
  %g{ data:{ icon:'download' } }
4
4
  %polygon{ points: '37 44 1 44 1 50 37 50' }
@@ -1,4 +1,4 @@
1
- %svg{ width: '100', height: '108', viewbox: '0 0 100 108', focusable: 'false', xmlns: 'http://www.w3.org/2000/svg' }
1
+ %svg{ width: '100', height: '108', viewbox: '0 0 100 108', xmlns: 'http://www.w3.org/2000/svg', aria:{ hidden: 'true' } }
2
2
  %title File icons
3
3
  %g{ data:{ icon:'file' } }
4
4
  %g{ data:{ icon:'page' }, stroke: 'none', fill: 'none', fill:{ rule: 'evenodd' } }
@@ -6,9 +6,9 @@
6
6
  %g{ data:{ icon: 'page-attributes' }, fill:{ rule: 'nonzero' } }
7
7
  %path{ data:{ icon: 'page-border' }, fill: '#cbc9cd', d: 'M2.01108433,2.00736845 L2.00021277,106.007368 L84.0002128,106.007368 L84.0002128,31.8971133 L55.246835,2.20661616 L2.01108433,2.00736845 Z M0.0112761248,0 L55.9803815,0 L86,31.0757723 L86,108 L0,108 L0.0112761248,0 Z' }
8
8
  %polygon{ data:{ icon:'page-fold' }, fill: '#cbc9cd', points: '83.0826977 29.9827586 85.0851064 31.9827586 53.9787234 31.9827586 53.9787234 0.913793103 55.9787234 2.91138733 55.9787234 29.9827586' }
9
- %g{ data:{ icon:'success' }, transform: 'translate(70.000000, 66.000000)' }
10
- %circle{ data:{ icon:'success-background' }, fill: '#00b95d', cx: '15', cy: '15', fill:{ rule: 'nonzero' }, r: '15' }
11
- %polyline{ data:{ icon:'success-text' }, fill: 'none', stroke: '#f8f7f7', stroke:{ width: '3' }, transform: 'translate(15.485282, 11.985281) rotate(-45.000000) translate(-15.485282, -11.985281)', points: '8.98528165 7.9852813 8.98528165 15.9852813 21.9852817 15.9852813' }
9
+ %g{ data:{ icon:'success' }, fill:{ rule: 'nonzero' }, transform: 'translate(70.000000, 66.000000)' }
10
+ %circle{ data:{ icon:'success-background' }, fill: '#00b95d', cx: '15', cy: '15', r: '15' }
11
+ %polyline{ data:{ icon:'success-text' }, :points => '8.98528137 7.98528137 8.98528137 15.9852814 21.9852814 15.9852814', :stroke => '#f8f7f7', 'stroke-width' => '3', :fill => 'none', :transform => 'translate(15.485281, 11.985281) rotate(-45.000000) translate(-15.485281, -11.985281) '}
12
12
  %g{ data:{ icon:'failure' }, fill:{ rule: 'nonzero' }, transform: 'translate(70.000000, 66.000000)' }
13
13
  %circle{ data:{ icon:'failure-background' }, fill: '#de2e32', cx: '15', cy: '15', r: '15' }
14
14
  %path{ data:{ icon:'failure-text' }, fill: '#f8f7f7', d: 'M16.8961039,7 L16.012987,17.7474747 L13.9350649,17.7474747 L13.0779221,7 L16.8961039,7 Z M13,21.0606061 C13,20.4859679 13.1904743,20.0190815 13.5714286,19.6599327 C13.9523829,19.3007838 14.4199106,19.1212121 14.974026,19.1212121 C15.5454574,19.1212121 16.0259721,19.3007838 16.4155844,19.6599327 C16.8051968,20.0190815 17,20.4859679 17,21.0606061 C17,21.6352442 16.8051968,22.1021306 16.4155844,22.4612795 C16.0259721,22.8204283 15.5454574,23 14.974026,23 C14.4199106,23 13.9523829,22.8204283 13.5714286,22.4612795 C13.1904743,22.1021306 13,21.6352442 13,21.0606061 Z' }
@@ -1,4 +1,4 @@
1
- %svg{"data-icon" => "search", :focusable => "false", :height => "20", :viewbox => "0 0 20 20", :width => "20", :xmlns => "http://www.w3.org/2000/svg"}
1
+ %svg{ width: '20', height: '20', viewbox: '0 0 20 20', xmlns: 'http://www.w3.org/2000/svg', aria:{ hidden: 'true' }, data:{ icon: 'search' } }
2
2
  %title Search icon
3
3
  %g{:fill => "#fff"}
4
4
  %path{:d => "M7.5 15C3.4 15 0 11.6 0 7.5 0 3.4 3.4 0 7.5 0 11.6 0 15 3.4 15 7.5 15 11.6 11.6 15 7.5 15ZM7.5 13C10.5 13 13 10.5 13 7.5 13 4.5 10.5 2 7.5 2 4.5 2 2 4.5 2 7.5 2 10.5 4.5 13 7.5 13Z"}
@@ -1,4 +1,4 @@
1
- %svg{:height => "54", :viewbox => "0 0 269 68", :width => "214", :xmlns => "http://www.w3.org/2000/svg"}
1
+ %svg{ width: '214', height: '54', viewbox: '0 0 269 68', xmlns: 'http://www.w3.org/2000/svg', aria:{ hidden: 'true' } }
2
2
  %title UK Parliament
3
3
 
4
4
  %g{"data-icon" => "portcullis", :fill => "#fff"}
@@ -18,9 +18,9 @@
18
18
  - Pugin.alternates.each do |alternate|
19
19
  %link{rel: 'alternate', type: alternate[:type], href: alternate[:href].html_safe}
20
20
  %body
21
- = render partial: 'pugin/javascript/has_js'
22
21
  - if ENV['GTM_KEY']
23
22
  = render partial: 'pugin/javascript/google_tag_manager_noscript'
23
+ = render partial: 'pugin/javascript/has_js'
24
24
  = render partial: 'pugin/elements/skip-content'
25
25
  = render partial: 'pugin/components/status-cookie'
26
26
  = render partial: 'pugin/components/status', locals: { status: nil } if Pugin::Feature::StatusBanner.enabled?
@@ -1,4 +1,2 @@
1
- - person_type = (people.current_mp? || people.former_mp?) ? "member" : "lord"
2
-
3
1
  %li
4
- = render partial: "pugin/people/list/#{person_type}/#{person_type}", locals: { "#{person_type}": local_assigns.fetch(:people, []), as: person_type }
2
+ = render partial: "pugin/people/list/#{people.person_type}/#{people.person_type}", locals: { "#{people.person_type}": local_assigns.fetch(:people, []), as: people.person_type }
@@ -1,4 +1,3 @@
1
- - current_incumbency = lord.seat_incumbencies.sort{ |inc_a, inc_b| inc_b.start_date <=> inc_a.start_date }.first
2
1
  - if Pugin::Feature::Bandiera.show_list_images?
3
2
  %figure
4
3
  %a{href: "/people/#{lord.graph_id}", tabindex: "-1"}
@@ -9,20 +8,19 @@
9
8
  %img{ src: "#{Pugin::ASSET_LOCATION_URL}/#{Pugin::ASSET_VERSION}/images/placeholder_members_image.png", alt: "" }
10
9
 
11
10
  .list--details
12
- - if !instance_variable_get("@parliament").nil? # parliament lord
11
+ %h2
12
+ %a{href: "/people/#{lord.graph_id}"}= lord.display_name
13
13
 
14
- - elsif current_incumbency&.current? # current lord
15
- %h2
16
- %a{href: "/people/#{lord.graph_id}"}= lord.display_name
17
- - unless lord.statuses[:house_membership_status].empty? && !lord.statuses[:house_membership_status].include?('Current MP')
18
- %p= lord.statuses[:house_membership_status].join(' and ')
19
- - unless lord.parties.empty?
20
- - party_membership = lord.party_memberships.select(&:current?).first
21
- - unless party_membership.nil?
22
- %p= party_membership.party.name
14
+ -# Currently only takes the most recent incumbency as part of that parliamentary period
15
+ - most_recent_incumbency = lord.most_recent_seat_incumbency
16
+
17
+ - if @parliament # parliament lord
18
+ %p= "Member of the #{t('house_of_lords')}"
19
+ %p= lord&.parties&.first&.name
20
+
21
+ - elsif most_recent_incumbency&.current? # current lord
22
+ %p= lord.statuses[:house_membership_status].join(' and ')
23
+ %p= lord.try(:current_party).try(:name)
23
24
 
24
25
  - else # former lord
25
- %h2
26
- %a{href: "/people/#{lord.graph_id}"}= lord.display_name
27
- - unless lord.statuses[:house_membership_status].empty? && !lord.statuses[:house_membership_status].include?('Current MP')
28
- %p= lord.statuses[:house_membership_status].join(' and ')
26
+ %p= lord.statuses[:house_membership_status].join(' and ')
@@ -1,5 +1,3 @@
1
- - current_incumbency = member.seat_incumbencies.select(&:current?).first
2
-
3
1
  - if Pugin::Feature::Bandiera.show_list_images?
4
2
  %figure
5
3
  %a{href: "/people/#{member.graph_id}", tabindex: "-1"}
@@ -10,35 +8,23 @@
10
8
  %img{ src: "#{Pugin::ASSET_LOCATION_URL}/#{Pugin::ASSET_VERSION}/images/placeholder_members_image.png", alt: "" }
11
9
 
12
10
  .list--details
13
- - if !instance_variable_get("@parliament").nil? # parliament member
14
- %h2
15
- %a{href: "/people/#{member.graph_id}"}= member.display_name
16
- - unless member.constituencies.empty?
17
- - unless member.seat_incumbencies.nil?
18
- - member.seat_incumbencies.each do |seat_incumbency|
19
- %p
20
- = "#{seat_incumbency.constituency.name} from #{l(seat_incumbency.start_date, format: :default)}"
21
- = seat_incumbency.end_date.nil? ? "#{I18n.t('shared.to_present')}" : "- #{l(seat_incumbency.end_date, format: :default)}"
11
+ %h2
12
+ %a{href: "/people/#{member.graph_id}"}= member.display_name
22
13
 
23
- - unless member.parties.empty?
24
- - member.party_memberships.each do |party_membership|
25
- %p= party_membership.party.name
14
+ -# Currently only takes the most recent incumbency as part of that parliamentary period
15
+ - parliament_incumbency = member.most_recent_seat_incumbency
16
+ - current_incumbency = member.current_seat_incumbency
26
17
 
27
- - elsif !current_incumbency.nil? # current member
28
- %h2
29
- %a{href: "/people/#{member.graph_id}"}= member.display_name
30
- - unless member.constituencies.empty?
31
- - seat_incumbency = member.seat_incumbencies.select(&:current?).first
32
- - unless seat_incumbency.nil?
33
- %p= "#{I18n.t('pugin.people.list.member.mp_for')} #{seat_incumbency.constituency.name}"
34
- - unless member.parties.empty?
35
- - party_membership = member.party_memberships.select(&:current?).first
36
- - unless party_membership.nil?
37
- %p= party_membership.party.name
18
+ - if @parliament # parliament member
19
+ - if parliament_incumbency&.constituency && parliament_incumbency&.start_date
20
+ %p
21
+ = "#{parliament_incumbency.constituency.name} from #{l(parliament_incumbency.start_date, format: :default)}"
22
+ = parliament_incumbency&.end_date.nil? ? "#{I18n.t('shared.to_present')}" : "- #{l(parliament_incumbency.end_date, format: :default)}"
23
+ %p= member&.parties&.first&.name
38
24
 
39
- - else # former member
25
+ - elsif current_incumbency&.constituency # current member
26
+ %p= "#{I18n.t('pugin.people.list.member.mp_for')} #{current_incumbency&.constituency&.name}"
27
+ %p= member.try(:current_party).try(:name)
40
28
 
41
- %h2
42
- %a{href: "/people/#{member.graph_id}"}= member.display_name
43
- - unless member.statuses[:house_membership_status].empty? && !member.statuses[:house_membership_status].include?('Current MP')
44
- %p= member.statuses[:house_membership_status].join(' and ')
29
+ - else # former member
30
+ %p= member.statuses[:house_membership_status].join(' and ')
@@ -1,5 +1,7 @@
1
1
  en:
2
- time:
2
+ #global people translations
3
+ house_of_lords: 'House of Lords'
4
+ time:
3
5
  formats:
4
6
  year_only: "%Y"
5
7
  pugin:
data/lib/pugin.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'pugin/version'
2
2
 
3
3
  module Pugin
4
- ASSET_VERSION = '1.7.3'.freeze
4
+ ASSET_VERSION = '1.7.4'.freeze
5
5
  ASSET_LOCATION_URL = ENV.fetch('ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1live.pugin-website')
6
6
  STATIC_ASSET_LOCATION_URL = ENV.fetch('STATIC_ASSET_LOCATION_URL', 'https://s3-eu-west-1.amazonaws.com/web1live.static-assets')
7
7
  class << self
data/lib/pugin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pugin
2
- VERSION = '1.6.10'.freeze
2
+ VERSION = '1.6.11'.freeze
3
3
  end
@@ -1,7 +1,7 @@
1
1
  <header>
2
2
  <div class='container'>
3
3
  <a class='uk_parliament' href='/'>
4
- <svg height='54' viewbox='0 0 269 68' width='214' xmlns='http://www.w3.org/2000/svg'>
4
+ <svg aria-hidden='true' height='54' viewbox='0 0 269 68' width='214' xmlns='http://www.w3.org/2000/svg'>
5
5
  <title>UK Parliament</title>
6
6
  <g data-icon='portcullis' fill='#fff'>
7
7
  <path d='M52.9 4.1L52.2 4.5C53 6 53.2 7.9 52.7 9.6 51.8 8.9 51.2 8 51 7L50.3 7.4C49.8 9.4 48.9 11.4 47.7 13.2L47.9 13.9C48.6 13.5 49.4 13.3 50.2 13.4 50.5 13.4 50.7 13.4 51 13.4 50.3 15.1 48.7 16.2 46.9 16.2 45.1 16.3 43.5 15.3 42.7 13.7 43.2 13.5 43.6 13 43.8 12.4 44 11.5 43.4 11.1 43.6 10.2 43.8 9.4 44.5 8.9 45.2 8.9 46 9 46.7 9.5 46.8 10.3 47.5 9.9 47.9 9.1 47.8 8.3 47.7 7.5 47.2 6.8 46.4 6.6 45.7 6.3 44.8 6.5 44.3 7.1 44.6 6.6 44.8 6.1 44.9 5.6 45.1 4.3 44.9 3 44.1 2 42.9 2.6 42 3.7 41.8 5 41.6 5.5 41.6 6.1 41.7 6.6 41.4 5.9 40.7 5.3 39.9 5.3 39.1 5.2 38.4 5.6 38 6.3 37.6 7 37.6 7.8 38.1 8.5 38.5 7.8 39.3 7.6 40 7.9 40.7 8.2 41.1 8.9 41 9.7 40.8 10.5 40.1 10.7 39.9 11.6 39.8 12.1 39.9 12.6 40.2 13L40.3 13.2C38.7 14.4 36.5 14.7 34.7 13.8 32.8 12.9 31.7 11 31.7 9L31.7 8.5C33.3 8.8 34.8 9.6 35.9 10.9L36.5 10.3 36.5 3.9 35.9 3.3C34.8 4.5 33.3 5.3 31.7 5.6 31.6 3.3 33.2 1.3 35.4 0.8L34.8 0.2C33.2 0.1 31.6 0 30 0 28.4 0 26.8 0.1 25.2 0.2L24.6 0.8C26.8 1.3 28.4 3.3 28.4 5.6 26.7 5.3 25.2 4.5 24.1 3.3L23.5 3.9 23.5 10.3 24.1 10.8C25.2 9.6 26.7 8.8 28.4 8.5L28.4 9C28.3 11 27.2 12.9 25.4 13.8 23.5 14.7 21.4 14.5 19.7 13.2L19.8 13.1C20.1 12.6 20.2 12.1 20.1 11.6 19.9 10.7 19.2 10.6 19 9.7 18.8 9 19.2 8.2 20 7.9 20.7 7.6 21.5 7.8 22 8.5 22.4 7.8 22.4 7 22 6.3 21.6 5.6 20.9 5.2 20.1 5.3 19.3 5.3 18.6 5.9 18.3 6.6 18.4 6.1 18.4 5.5 18.2 5 18 3.7 17.1 2.6 15.9 2 15.1 3 14.8 4.4 15.1 5.7 15.2 6.2 15.4 6.7 15.7 7.2 15.1 6.6 14.3 6.4 13.5 6.7 12.8 6.9 12.2 7.6 12.2 8.4 12.1 9.2 12.5 10 13.2 10.4 13.3 9.6 13.9 9.1 14.7 9 15.5 9 16.2 9.5 16.4 10.3 16.6 11.2 16 11.6 16.2 12.4 16.3 13 16.7 13.5 17.3 13.8 16.5 15.4 14.8 16.3 13 16.3 11.3 16.2 9.7 15.1 9 13.5 9.3 13.4 9.5 13.4 9.8 13.4 10.6 13.4 11.4 13.6 12.1 14L12.3 13.2C11.1 11.4 10.2 9.5 9.6 7.4L9 7C8.8 8 8.2 8.9 7.3 9.6 6.8 7.9 7 6 7.8 4.5L7.1 4.1C6 4.5 4.3 5.2 3.1 5.7L10 21.1C22.7 15.5 37.2 15.5 50 21.1L56.8 5.7C55.7 5.2 54.1 4.5 52.9 4.1Z'></path>
@@ -1,7 +1,7 @@
1
1
  <header>
2
2
  <div class='container'>
3
3
  <a class='uk_parliament' href='/'>
4
- <svg height='54' viewbox='0 0 269 68' width='214' xmlns='http://www.w3.org/2000/svg'>
4
+ <svg aria-hidden='true' height='54' viewbox='0 0 269 68' width='214' xmlns='http://www.w3.org/2000/svg'>
5
5
  <title>UK Parliament</title>
6
6
  <g data-icon='portcullis' fill='#fff'>
7
7
  <path d='M52.9 4.1L52.2 4.5C53 6 53.2 7.9 52.7 9.6 51.8 8.9 51.2 8 51 7L50.3 7.4C49.8 9.4 48.9 11.4 47.7 13.2L47.9 13.9C48.6 13.5 49.4 13.3 50.2 13.4 50.5 13.4 50.7 13.4 51 13.4 50.3 15.1 48.7 16.2 46.9 16.2 45.1 16.3 43.5 15.3 42.7 13.7 43.2 13.5 43.6 13 43.8 12.4 44 11.5 43.4 11.1 43.6 10.2 43.8 9.4 44.5 8.9 45.2 8.9 46 9 46.7 9.5 46.8 10.3 47.5 9.9 47.9 9.1 47.8 8.3 47.7 7.5 47.2 6.8 46.4 6.6 45.7 6.3 44.8 6.5 44.3 7.1 44.6 6.6 44.8 6.1 44.9 5.6 45.1 4.3 44.9 3 44.1 2 42.9 2.6 42 3.7 41.8 5 41.6 5.5 41.6 6.1 41.7 6.6 41.4 5.9 40.7 5.3 39.9 5.3 39.1 5.2 38.4 5.6 38 6.3 37.6 7 37.6 7.8 38.1 8.5 38.5 7.8 39.3 7.6 40 7.9 40.7 8.2 41.1 8.9 41 9.7 40.8 10.5 40.1 10.7 39.9 11.6 39.8 12.1 39.9 12.6 40.2 13L40.3 13.2C38.7 14.4 36.5 14.7 34.7 13.8 32.8 12.9 31.7 11 31.7 9L31.7 8.5C33.3 8.8 34.8 9.6 35.9 10.9L36.5 10.3 36.5 3.9 35.9 3.3C34.8 4.5 33.3 5.3 31.7 5.6 31.6 3.3 33.2 1.3 35.4 0.8L34.8 0.2C33.2 0.1 31.6 0 30 0 28.4 0 26.8 0.1 25.2 0.2L24.6 0.8C26.8 1.3 28.4 3.3 28.4 5.6 26.7 5.3 25.2 4.5 24.1 3.3L23.5 3.9 23.5 10.3 24.1 10.8C25.2 9.6 26.7 8.8 28.4 8.5L28.4 9C28.3 11 27.2 12.9 25.4 13.8 23.5 14.7 21.4 14.5 19.7 13.2L19.8 13.1C20.1 12.6 20.2 12.1 20.1 11.6 19.9 10.7 19.2 10.6 19 9.7 18.8 9 19.2 8.2 20 7.9 20.7 7.6 21.5 7.8 22 8.5 22.4 7.8 22.4 7 22 6.3 21.6 5.6 20.9 5.2 20.1 5.3 19.3 5.3 18.6 5.9 18.3 6.6 18.4 6.1 18.4 5.5 18.2 5 18 3.7 17.1 2.6 15.9 2 15.1 3 14.8 4.4 15.1 5.7 15.2 6.2 15.4 6.7 15.7 7.2 15.1 6.6 14.3 6.4 13.5 6.7 12.8 6.9 12.2 7.6 12.2 8.4 12.1 9.2 12.5 10 13.2 10.4 13.3 9.6 13.9 9.1 14.7 9 15.5 9 16.2 9.5 16.4 10.3 16.6 11.2 16 11.6 16.2 12.4 16.3 13 16.7 13.5 17.3 13.8 16.5 15.4 14.8 16.3 13 16.3 11.3 16.2 9.7 15.1 9 13.5 9.3 13.4 9.5 13.4 9.8 13.4 10.6 13.4 11.4 13.6 12.1 14L12.3 13.2C11.1 11.4 10.2 9.5 9.6 7.4L9 7C8.8 8 8.2 8.9 7.3 9.6 6.8 7.9 7 6 7.8 4.5L7.1 4.1C6 4.5 4.3 5.2 3.1 5.7L10 21.1C22.7 15.5 37.2 15.5 50 21.1L56.8 5.7C55.7 5.2 54.1 4.5 52.9 4.1Z'></path>
@@ -30,7 +30,7 @@
30
30
  <label class='sr-only' for='search_global'>Enter a keyword</label>
31
31
  <input id='search_global' maxlength='1000' name='q' pattern='^(?!.*&lt;script|&lt;Script).*$' required='' type='search'>
32
32
  <button aria-label='submit search' class='btn--white' data-tracking='search' tabindex='-1' type='submit'>
33
- <svg data-icon='search' focusable='false' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
33
+ <svg aria-hidden='true' data-icon='search' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
34
34
  <title>Search icon</title>
35
35
  <g fill='#fff'>
36
36
  <path d='M7.5 15C3.4 15 0 11.6 0 7.5 0 3.4 3.4 0 7.5 0 11.6 0 15 3.4 15 7.5 15 11.6 11.6 15 7.5 15ZM7.5 13C10.5 13 13 10.5 13 7.5 13 4.5 10.5 2 7.5 2 4.5 2 2 4.5 2 7.5 2 10.5 4.5 13 7.5 13Z'></path>
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  </form>
44
44
  <a aria-label='open search' class='search__global__toggle' href='#'>
45
- <svg data-icon='search' focusable='false' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
45
+ <svg aria-hidden='true' data-icon='search' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
46
46
  <title>Search icon</title>
47
47
  <g fill='#fff'>
48
48
  <path d='M7.5 15C3.4 15 0 11.6 0 7.5 0 3.4 3.4 0 7.5 0 11.6 0 15 3.4 15 7.5 15 11.6 11.6 15 7.5 15ZM7.5 13C10.5 13 13 10.5 13 7.5 13 4.5 10.5 2 7.5 2 4.5 2 2 4.5 2 7.5 2 10.5 4.5 13 7.5 13Z'></path>
@@ -50,7 +50,7 @@
50
50
  </g>
51
51
  </svg>
52
52
 
53
- <svg data-icon='close' focusable='false' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
53
+ <svg aria-hidden='true' data-icon='close' height='20' viewbox='0 0 20 20' width='20' xmlns='http://www.w3.org/2000/svg'>
54
54
  <title>Cross</title>
55
55
  <g stroke='#fff'>
56
56
  <g>
@@ -1,42 +1,43 @@
1
1
  require 'spec_helper'
2
2
  require 'pugin/helpers/controller_helpers'
3
3
 
4
- describe 'pugin/helpers/controller_helpers.rb' do
4
+ describe 'pugin/helpers/controller_helpers.rb' do
5
5
 
6
- before do
6
+ before do
7
7
  class TestClass
8
8
  include Pugin::Helpers::ControllerHelpers
9
- end
9
+ end
10
10
  end
11
11
 
12
12
  subject { TestClass.new }
13
13
 
14
14
  context '#enable_status_banner' do
15
- it 'enables the status banner' do
15
+ it 'enables the status banner' do
16
16
  subject.enable_status_banner
17
17
  expect(Pugin::Feature::StatusBanner.enabled?).to equal(true)
18
18
  end
19
19
  end
20
- context '#disable_status_banner' do
21
20
 
22
- before :each do
21
+ context '#disable_status_banner' do
22
+ before :each do
23
23
  Pugin::Feature::StatusBanner.enable
24
24
  end
25
25
 
26
- it 'disables the status banner' do
26
+ it 'disables the status banner' do
27
27
  expect(Pugin::Feature::StatusBanner.disabled?).to equal(false)
28
28
  subject.disable_status_banner
29
29
  expect(Pugin::Feature::StatusBanner.disabled?).to equal(true)
30
30
  end
31
31
  end
32
+
32
33
  context '#enable_global_search' do
33
34
  it 'enables the global search' do
34
35
  subject.enable_global_search
35
36
  expect(Pugin::Feature::GlobalSearch.enabled?).to equal(true)
36
37
  end
37
38
  end
38
- context '#disable_global_search' do
39
39
 
40
+ context '#disable_global_search' do
40
41
  before :each do
41
42
  Pugin::Feature::GlobalSearch.enable
42
43
  end
@@ -47,25 +48,27 @@ describe 'pugin/helpers/controller_helpers.rb' do
47
48
  expect(Pugin::Feature::GlobalSearch.disabled?).to equal(true)
48
49
  end
49
50
  end
50
- context '#enable_top_navigation' do
51
- it 'enables the top navigation' do
51
+
52
+ context '#enable_top_navigation' do
53
+ it 'enables the top navigation' do
52
54
  subject.enable_top_navigation
53
55
  expect(Pugin::Feature::TopNavigation.enabled?).to equal(true)
54
56
  end
55
57
  end
56
- context '#disable_top_navigation' do
57
58
 
58
- before :each do
59
+ context '#disable_top_navigation' do
60
+ before :each do
59
61
  Pugin::Feature::TopNavigation.enable
60
62
  end
61
63
 
62
- it 'disables the top navigation' do
64
+ it 'disables the top navigation' do
63
65
  expect(Pugin::Feature::TopNavigation.disabled?).to equal(false)
64
66
  subject.disable_top_navigation
65
67
  expect(Pugin::Feature::TopNavigation.disabled?).to equal(true)
66
68
  end
67
69
  end
68
- context '#reset_bandiera_features' do
70
+
71
+ context '#reset_bandiera_features' do
69
72
  before :each do
70
73
  Pugin::Feature::Bandiera.instance_variable_set(:@features, {'show-register' => true, 'show-dissolution' => true})
71
74
  end
@@ -2,23 +2,23 @@ require 'spec_helper'
2
2
  require 'haml'
3
3
 
4
4
  describe 'pugin/components/_header.html.haml', type: :view do
5
-
6
5
  context 'with global_search flag turned on' do
7
6
  before :each do
8
7
  allow(Pugin::Feature::GlobalSearch).to receive(:enabled?).and_return(true)
9
8
  end
10
-
11
9
  it 'renders as expected' do
12
- render
13
- expect(response).to eq(File.read(File.join(Rails.root, '../fixtures', '_header_with_search.html')))
14
- end
10
+ render
11
+ expect(response).to eq(File.read(File.join(Rails.root, '../fixtures', '_header_with_search.html')))
12
+ end
15
13
  end
16
14
 
17
15
  context 'without global_search flag turned on' do
16
+ before :each do
17
+ allow(Pugin::Feature::GlobalSearch).to receive(:enabled?).and_return(false)
18
+ end
18
19
  it 'renders as expected' do
19
20
  render
20
21
  expect(response).to eq(File.read(File.join(Rails.root, '../fixtures', '_header.html')))
21
22
  end
22
23
  end
23
-
24
24
  end
@@ -0,0 +1,100 @@
1
+ require 'spec_helper'
2
+ require 'haml'
3
+
4
+ describe 'pugin/people/list/member/_member.html.haml', type: :view do
5
+
6
+ context 'with a current lord data set' do
7
+
8
+ let(:current_lord_data_set) { Class.new }
9
+ let(:current_lord_seat_incumbency) { Class.new }
10
+ let(:current_lord_party) { Class.new }
11
+
12
+ before :each do
13
+
14
+ allow(current_lord_seat_incumbency).to receive(:current?).and_return(true)
15
+ allow(current_lord_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2018,1,23,4,5,6))
16
+
17
+ allow(current_lord_party).to receive(:name).and_return('Labour')
18
+
19
+ allow(current_lord_data_set).to receive(:parties).and_return([1,2,3])
20
+ allow(current_lord_data_set).to receive(:most_recent_seat_incumbency).and_return(current_lord_seat_incumbency)
21
+ allow(current_lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Member of the House of Lords']})
22
+ allow(current_lord_data_set).to receive(:current_party).and_return(current_lord_party)
23
+ allow(current_lord_data_set).to receive(:person_type).and_return('lord')
24
+ allow(current_lord_data_set).to receive(:graph_id).and_return('123')
25
+ allow(current_lord_data_set).to receive(:display_name).and_return('currentlord1')
26
+ allow(current_lord_data_set).to receive(:image_id).and_return('456')
27
+
28
+ @people = [current_lord_data_set]
29
+ end
30
+
31
+ it "renders the current lord data" do
32
+ render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
33
+ expect(response).to include("<a href='/people/123'>currentlord1</a>")
34
+ expect(response).to include("<p>Member of the House of Lords</p>")
35
+ expect(response).to include("<p>Labour</p>")
36
+ end
37
+ end
38
+
39
+ context 'with a former lord data set' do
40
+
41
+ let(:former_lord_data_set) { Class.new }
42
+ let(:former_lord_seat_incumbency) { Class.new }
43
+
44
+ before :each do
45
+
46
+ allow(former_lord_seat_incumbency).to receive(:current?).and_return(false)
47
+ allow(former_lord_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2018,1,23,4,5,6))
48
+
49
+ allow(former_lord_data_set).to receive(:most_recent_seat_incumbency).and_return(former_lord_seat_incumbency)
50
+ allow(former_lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Former Member of the House of Lords']})
51
+ allow(former_lord_data_set).to receive(:person_type).and_return('lord')
52
+ allow(former_lord_data_set).to receive(:graph_id).and_return('123')
53
+ allow(former_lord_data_set).to receive(:display_name).and_return('formerlord1')
54
+ allow(former_lord_data_set).to receive(:image_id).and_return('456')
55
+
56
+ @people = [former_lord_data_set]
57
+ end
58
+
59
+ it "renders the former lord data" do
60
+ render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
61
+ expect(response).to include("<a href='/people/123'>formerlord1</a>")
62
+ expect(response).to include("<p>Former Member of the House of Lords</p>")
63
+ end
64
+ end
65
+
66
+ context 'with a parliament lord data set' do
67
+
68
+ let(:parliament_lord_data_set) { Class.new }
69
+ let(:parliament_lord_seat_incumbency) { Class.new }
70
+ let(:parliament_lord_party) { Class.new }
71
+ let(:parliament_lord_party_memberships) { Class.new }
72
+ let(:parliament_lord_statuses) { Class.new }
73
+
74
+ before :each do
75
+ @parliament = [1,2,3]
76
+
77
+ allow(parliament_lord_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2018,1,23,4,5,6))
78
+
79
+ allow(parliament_lord_party).to receive(:name).and_return('Conservative')
80
+
81
+ allow(parliament_lord_data_set).to receive(:parties).and_return([parliament_lord_party])
82
+ allow(parliament_lord_data_set).to receive(:most_recent_seat_incumbency).and_return(parliament_lord_seat_incumbency)
83
+ allow(parliament_lord_data_set).to receive(:person_type).and_return('lord')
84
+ allow(parliament_lord_data_set).to receive(:graph_id).and_return('123')
85
+ allow(parliament_lord_data_set).to receive(:display_name).and_return('currentlord1')
86
+ allow(parliament_lord_data_set).to receive(:image_id).and_return('456')
87
+
88
+ @people = [parliament_lord_data_set]
89
+
90
+ end
91
+
92
+ it "renders the parliament lord data" do
93
+ render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
94
+ expect(response).to include("<a href='/people/123'>currentlord1</a>")
95
+ expect(response).to include("<p>Member of the House of Lords</p>")
96
+ expect(response).to include("<p>Conservative</p>")
97
+ end
98
+
99
+ end
100
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'haml'
3
3
 
4
- describe 'pugin/people/list/member/_member.html.haml', type: :view do
4
+ describe 'pugin/people/list/member/_member.html.haml', type: :view do
5
5
 
6
6
  context 'with a current MP data set' do
7
7
 
@@ -9,36 +9,32 @@ describe 'pugin/people/list/member/_member.html.haml', type: :view do
9
9
  let(:current_mp_seat_incumbency) { Class.new }
10
10
  let(:current_mp_constituency) { Class.new }
11
11
  let(:current_mp_party) { Class.new }
12
- let(:current_mp_party_memberships) { Class.new }
13
12
 
14
- before :each do
13
+ before :each do
15
14
  allow(current_mp_constituency).to receive(:name).and_return('constituency1')
16
15
 
17
- allow(current_mp_seat_incumbency).to receive(:current?).and_return(true)
18
16
  allow(current_mp_seat_incumbency).to receive(:constituency).and_return(current_mp_constituency)
17
+ allow(current_mp_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2018, 01, 22, 4, 5, 6))
19
18
 
20
19
  allow(current_mp_party).to receive(:name).and_return('Labour')
21
20
 
22
- allow(current_mp_party_memberships).to receive(:current?).and_return(true)
23
- allow(current_mp_party_memberships).to receive(:party).and_return(current_mp_party)
24
-
25
- allow(current_mp_data_set).to receive(:house_incumbencies).and_return([])
26
- allow(current_mp_data_set).to receive(:seat_incumbencies).and_return([current_mp_seat_incumbency])
27
- allow(current_mp_data_set).to receive(:constituencies).and_return([current_mp_constituency])
28
- allow(current_mp_data_set).to receive(:parties).and_return([1,2,3])
29
- allow(current_mp_data_set).to receive(:party_memberships).and_return([current_mp_party_memberships])
30
-
21
+ allow(current_mp_data_set).to receive(:current_party).and_return(current_mp_party)
22
+ allow(current_mp_data_set).to receive(:most_recent_seat_incumbency).and_return(current_mp_seat_incumbency)
23
+ allow(current_mp_data_set).to receive(:current_seat_incumbency).and_return(current_mp_seat_incumbency)
24
+ allow(current_mp_data_set).to receive(:parties).and_return([current_mp_party])
25
+ allow(current_mp_data_set).to receive(:image_id).and_return('456')
26
+ allow(current_mp_data_set).to receive(:person_type).and_return('member')
31
27
  allow(current_mp_data_set).to receive(:graph_id).and_return('123')
32
28
  allow(current_mp_data_set).to receive(:display_name).and_return('currentmp1')
33
29
 
34
30
  @people = [current_mp_data_set]
35
31
  end
36
32
 
37
- it "renders the current MP data" do
33
+ it "renders the current MP data" do
38
34
  render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
39
- expect(response).to include("<a href='/people/123'>currentmp1</a>")
40
- expect(response).to include("<p>MP for constituency1</p>")
41
- expect(response).to include("<p>Labour</p>")
35
+ expect(response).to include("<a href='/people/123'>currentmp1</a>")
36
+ expect(response).to include("<p>MP for constituency1</p>")
37
+ expect(response).to include("<p>Labour</p>")
42
38
  end
43
39
  end
44
40
 
@@ -48,71 +44,69 @@ describe 'pugin/people/list/member/_member.html.haml', type: :view do
48
44
  let(:former_mp_seat_incumbency) { Class.new }
49
45
  let(:former_mp_constituency) { Class.new }
50
46
 
51
- before :each do
47
+ before :each do
52
48
 
53
49
  allow(former_mp_constituency).to receive(:name).and_return('constituency1')
54
50
 
55
51
  allow(former_mp_seat_incumbency).to receive(:current?).and_return(false)
56
- allow(former_mp_seat_incumbency).to receive(:constituency).and_return(former_mp_constituency)
52
+ allow(former_mp_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2018, 01, 22, 4, 5, 6))
57
53
 
58
- allow(former_mp_data_set).to receive(:house_incumbencies).and_return([])
59
- allow(former_mp_data_set).to receive(:seat_incumbencies).and_return([former_mp_seat_incumbency])
54
+ allow(former_mp_data_set).to receive(:most_recent_seat_incumbency).and_return(former_mp_seat_incumbency)
55
+ allow(former_mp_data_set).to receive(:current_seat_incumbency).and_return(nil)
60
56
  allow(former_mp_data_set).to receive(:graph_id).and_return('123')
61
57
  allow(former_mp_data_set).to receive(:display_name).and_return('formermp1')
62
- allow(former_mp_data_set).to receive(:statuses).and_return({house_membership_status: ['Former MP']})
63
-
58
+ allow(former_mp_data_set).to receive(:statuses).and_return({house_membership_status: ['Former MP']})
59
+ allow(former_mp_data_set).to receive(:image_id).and_return('456')
60
+ allow(former_mp_data_set).to receive(:person_type).and_return('member')
64
61
 
65
62
  @people = [former_mp_data_set]
66
63
  end
67
64
 
68
- it "renders the former MP data" do
65
+ it "renders the former MP data" do
69
66
  render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
70
- expect(response).to include("<a href='/people/123'>formermp1</a>")
71
- expect(response).to include("<p>Former MP</p>")
67
+ expect(response).to include("<a href='/people/123'>formermp1</a>")
68
+ expect(response).to include("<p>Former MP</p>")
72
69
  end
73
70
  end
74
71
 
75
- context 'with a parliament MP data set' do
72
+ context 'with a parliament MP data set' do
76
73
 
77
74
  let(:parliament_mp_data_set) { Class.new }
78
75
  let(:parliament_mp_seat_incumbency) { Class.new }
79
76
  let(:parliament_mp_constituency) { Class.new }
80
77
  let(:parliament_mp_party) { Class.new }
81
- let(:parliament_mp_party_memberships) { Class.new }
82
78
 
83
- before :each do
79
+ before :each do
84
80
  @parliament = [1,2,3]
85
81
 
86
82
  allow(parliament_mp_constituency).to receive(:name).and_return('constituency1')
87
83
 
88
- allow(parliament_mp_seat_incumbency).to receive(:current?).and_return(true)
84
+ allow(parliament_mp_seat_incumbency).to receive(:current?).and_return(false)
89
85
  allow(parliament_mp_seat_incumbency).to receive(:start_date).and_return(DateTime.new(2017,2,3,4,5,6))
90
86
  allow(parliament_mp_seat_incumbency).to receive(:end_date).and_return(DateTime.new(2017,2,3,4,5,6))
91
87
  allow(parliament_mp_seat_incumbency).to receive(:constituency).and_return(parliament_mp_constituency)
92
88
 
93
- allow(parliament_mp_party).to receive(:name).and_return('Labour')
94
-
95
- allow(parliament_mp_party_memberships).to receive(:current?).and_return(true)
96
- allow(parliament_mp_party_memberships).to receive(:party).and_return(parliament_mp_party)
97
-
98
- allow(parliament_mp_data_set).to receive(:house_incumbencies).and_return([])
99
- allow(parliament_mp_data_set).to receive(:seat_incumbencies).and_return([parliament_mp_seat_incumbency])
100
- allow(parliament_mp_data_set).to receive(:constituencies).and_return([parliament_mp_constituency])
101
- allow(parliament_mp_data_set).to receive(:parties).and_return([1,2,3])
102
- allow(parliament_mp_data_set).to receive(:party_memberships).and_return([parliament_mp_party_memberships])
89
+ allow(parliament_mp_party).to receive(:name).and_return('Green Party')
103
90
 
91
+ allow(parliament_mp_data_set).to receive(:most_recent_seat_incumbency).and_return(parliament_mp_seat_incumbency)
92
+ allow(parliament_mp_data_set).to receive(:current_seat_incumbency).and_return(parliament_mp_seat_incumbency)
93
+ allow(parliament_mp_data_set).to receive(:parties).and_return([parliament_mp_party])
94
+ allow(parliament_mp_data_set).to receive(:person_type).and_return('member')
95
+ allow(parliament_mp_data_set).to receive(:image_id).and_return('456')
104
96
  allow(parliament_mp_data_set).to receive(:graph_id).and_return('123')
105
97
  allow(parliament_mp_data_set).to receive(:display_name).and_return('parliamentmp1')
106
98
 
107
99
  @people = [parliament_mp_data_set]
108
100
  end
109
101
 
110
- it "renders the parliament MP data" do
102
+ it "renders the parliament MP data" do
111
103
  render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
112
104
  expect(response).to include("<a href='/people/123'>parliamentmp1</a>")
113
- expect(response).to include("<p>constituency1 from Fri, 03 Feb 2017 04:05:06 +0000 - Fri, 03 Feb 2017 04:05:06 +0000</p>")
114
- expect(response).to include("<p>Labour</p>")
105
+ expect(response).to include("<p>
106
+ constituency1 from Fri, 03 Feb 2017 04:05:06 +0000
107
+ - Fri, 03 Feb 2017 04:05:06 +0000
108
+ </p>")
109
+ expect(response).to include("<p>Green Party</p>")
115
110
  end
116
-
117
111
  end
118
112
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.10
4
+ version: 1.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rayner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-29 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -313,9 +313,8 @@ files:
313
313
  - spec/views/pugin/constituencies/list/_list.html.haml_spec.rb
314
314
  - spec/views/pugin/elements/_list.html.haml_spec.rb
315
315
  - spec/views/pugin/layouts/_layout.html.haml_spec.rb
316
- - spec/views/pugin/people/list/_list.html.haml
317
- - spec/views/pugin/people/list/lord/_lord.html.haml
318
- - spec/views/pugin/people/list/member/_member.html.haml
316
+ - spec/views/pugin/people/list/lord/_lord.html.haml_spec.rb
317
+ - spec/views/pugin/people/list/member/_member.html.haml_spec.rb
319
318
  homepage: https://github.com/ukparliament/pugin
320
319
  licenses:
321
320
  - Nonstandard
@@ -414,6 +413,5 @@ test_files:
414
413
  - spec/views/pugin/components/_footer.html.haml_spec.rb
415
414
  - spec/views/pugin/components/_navigation-main.html.haml_spec.rb
416
415
  - spec/views/pugin/elements/_list.html.haml_spec.rb
417
- - spec/views/pugin/people/list/_list.html.haml
418
- - spec/views/pugin/people/list/lord/_lord.html.haml
419
- - spec/views/pugin/people/list/member/_member.html.haml
416
+ - spec/views/pugin/people/list/lord/_lord.html.haml_spec.rb
417
+ - spec/views/pugin/people/list/member/_member.html.haml_spec.rb
@@ -1,81 +0,0 @@
1
- require 'spec_helper'
2
- require 'haml'
3
-
4
- describe 'pugin/people/list/_list.html.haml', type: :view do
5
-
6
- context 'with a MP data set' do
7
-
8
- let(:mp_data_set) { Class.new }
9
- let(:mp_seat_incumbency) { Class.new }
10
- let(:mp_constituency) { Class.new }
11
- let(:mp_party) { Class.new }
12
- let(:mp_party_memberships) { Class.new }
13
-
14
- before :each do
15
- allow(mp_constituency).to receive(:name).and_return('constituency1')
16
-
17
- allow(mp_seat_incumbency).to receive(:current?).and_return(true)
18
- allow(mp_seat_incumbency).to receive(:constituency).and_return(mp_constituency)
19
-
20
- allow(mp_party).to receive(:name).and_return('Labour')
21
-
22
- allow(mp_party_memberships).to receive(:current?).and_return(true)
23
- allow(mp_party_memberships).to receive(:party).and_return(mp_party)
24
-
25
- allow(mp_data_set).to receive(:house_incumbencies).and_return([])
26
- allow(mp_data_set).to receive(:seat_incumbencies).and_return([mp_seat_incumbency])
27
- allow(mp_data_set).to receive(:constituencies).and_return([mp_constituency])
28
- allow(mp_data_set).to receive(:parties).and_return([1,2,3])
29
- allow(mp_data_set).to receive(:party_memberships).and_return([mp_party_memberships])
30
-
31
- allow(mp_data_set).to receive(:graph_id).and_return('123')
32
- allow(mp_data_set).to receive(:display_name).and_return('mp1')
33
-
34
- @people = [mp_data_set]
35
- end
36
-
37
- it "renders the member partial" do
38
- render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
39
- expect(response).to include("<a href='/people/123'>mp1</a>")
40
- expect(response).to include("<p>Current MP for constituency1</p>")
41
- expect(response).to include("<p>Labour</p>")
42
- end
43
- end
44
-
45
- context 'with a Lord data set' do
46
-
47
- let(:lord_data_set) { Class.new }
48
- let(:lord_house_incumbency) { Class.new }
49
- let(:lord_party) { Class.new }
50
- let(:lord_party_memberships) { Class.new }
51
- let(:lord_statuses) { Class.new }
52
-
53
- before :each do
54
-
55
- allow(lord_house_incumbency).to receive(:current?).and_return(true)
56
- allow(lord_house_incumbency).to receive(:start_date).and_return('123')
57
-
58
- allow(lord_party).to receive(:name).and_return('Labour')
59
-
60
- allow(lord_party_memberships).to receive(:current?).and_return(true)
61
- allow(lord_party_memberships).to receive(:party).and_return(lord_party)
62
-
63
- allow(lord_data_set).to receive(:parties).and_return([1,2,3])
64
- allow(lord_data_set).to receive(:house_incumbencies).and_return([lord_house_incumbency])
65
- allow(lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Member of the House of Lords']})
66
- allow(lord_data_set).to receive(:party_memberships).and_return([lord_party_memberships])
67
-
68
- allow(lord_data_set).to receive(:graph_id).and_return('123')
69
- allow(lord_data_set).to receive(:display_name).and_return('lord1')
70
-
71
- @people = [lord_data_set]
72
- end
73
-
74
- it "renders the lord partial" do
75
- render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
76
- expect(response).to include("<a href='/people/123'>lord1</a>")
77
- expect(response).to include("<p>Member of the House of Lords</p>")
78
- expect(response).to include("<p>Labour</p>")
79
- end
80
- end
81
- end
@@ -1,110 +0,0 @@
1
- require 'spec_helper'
2
- require 'haml'
3
-
4
- describe 'pugin/people/list/member/_member.html.haml', type: :view do
5
-
6
- context 'with a current lord data set' do
7
-
8
- let(:current_lord_data_set) { Class.new }
9
- let(:current_lord_house_incumbency) { Class.new }
10
- let(:current_lord_party) { Class.new }
11
- let(:current_lord_party_memberships) { Class.new }
12
- let(:current_lord_statuses) { Class.new }
13
-
14
- before :each do
15
-
16
- allow(current_lord_house_incumbency).to receive(:current?).and_return(true)
17
- allow(current_lord_house_incumbency).to receive(:start_date).and_return('123')
18
-
19
- allow(current_lord_party).to receive(:name).and_return('Labour')
20
-
21
- allow(current_lord_party_memberships).to receive(:current?).and_return(true)
22
- allow(current_lord_party_memberships).to receive(:party).and_return(current_lord_party)
23
-
24
- allow(current_lord_data_set).to receive(:parties).and_return([1,2,3])
25
- allow(current_lord_data_set).to receive(:house_incumbencies).and_return([current_lord_house_incumbency])
26
- allow(current_lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Member of the House of Lords']})
27
- allow(current_lord_data_set).to receive(:party_memberships).and_return([current_lord_party_memberships])
28
-
29
- allow(current_lord_data_set).to receive(:graph_id).and_return('123')
30
- allow(current_lord_data_set).to receive(:display_name).and_return('currentlord1')
31
-
32
- @people = [current_lord_data_set]
33
- end
34
-
35
- it "renders the current lord data" do
36
- render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
37
- expect(response).to include("<a href='/people/123'>currentlord1</a>")
38
- expect(response).to include("<p>Member of the House of Lords</p>")
39
- expect(response).to include("<p>Labour</p>")
40
- end
41
- end
42
-
43
- context 'with a former lord data set' do
44
-
45
- let(:former_lord_data_set) { Class.new }
46
- let(:former_lord_house_incumbency) { Class.new }
47
- let(:former_lord_party) { Class.new }
48
- let(:former_lord_party_memberships) { Class.new }
49
- let(:former_lord_statuses) { Class.new }
50
-
51
- before :each do
52
-
53
- allow(former_lord_house_incumbency).to receive(:current?).and_return(false)
54
- allow(former_lord_house_incumbency).to receive(:start_date).and_return('123')
55
-
56
- allow(former_lord_data_set).to receive(:house_incumbencies).and_return([former_lord_house_incumbency])
57
- allow(former_lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Former Member of the House of Lords']})
58
- allow(former_lord_data_set).to receive(:party_memberships).and_return([former_lord_party_memberships])
59
-
60
- allow(former_lord_data_set).to receive(:graph_id).and_return('123')
61
- allow(former_lord_data_set).to receive(:display_name).and_return('formerlord1')
62
-
63
- @people = [former_lord_data_set]
64
- end
65
-
66
- it "renders the former lord data" do
67
- render partial: "pugin/people/list/list", collection: @people, as: "people".to_sym
68
- expect(response).to include("<a href='/people/123'>formerlord1</a>")
69
- expect(response).to include("<p>Former Member of the House of Lords</p>")
70
- end
71
- end
72
-
73
- context 'with a parliament lord data set' do
74
-
75
- let(:parliament_lord_data_set) { Class.new }
76
- let(:parliament_lord_house_incumbency) { Class.new }
77
- let(:parliament_lord_party) { Class.new }
78
- let(:parliament_lord_party_memberships) { Class.new }
79
- let(:parliament_lord_statuses) { Class.new }
80
-
81
- before :each do
82
- @parliament = [1,2,3]
83
-
84
- allow(parliament_lord_house_incumbency).to receive(:current?).and_return(true)
85
- allow(parliament_lord_house_incumbency).to receive(:start_date).and_return('123')
86
-
87
- allow(parliament_lord_party).to receive(:name).and_return('Labour')
88
-
89
- allow(parliament_lord_party_memberships).to receive(:current?).and_return(true)
90
- allow(parliament_lord_party_memberships).to receive(:party).and_return(parliament_lord_party)
91
-
92
- allow(parliament_lord_data_set).to receive(:parties).and_return([1,2,3])
93
- allow(parliament_lord_data_set).to receive(:house_incumbencies).and_return([parliament_lord_house_incumbency])
94
- allow(parliament_lord_data_set).to receive(:statuses).and_return({house_membership_status: ['Member of the House of Lords']})
95
- allow(parliament_lord_data_set).to receive(:party_memberships).and_return([parliament_lord_party_memberships])
96
-
97
- allow(parliament_lord_data_set).to receive(:graph_id).and_return('123')
98
- allow(parliament_lord_data_set).to receive(:display_name).and_return('currentlord1')
99
-
100
- @people = [parliament_lord_data_set]
101
-
102
- end
103
-
104
- it "renders the parliament lord data" do
105
- pending("Lord parliament data set not finalised")
106
- this_should_not_get_executed
107
- end
108
-
109
- end
110
- end