pugin 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23d909450967839cf8cd587211a8bcfc9080174d
4
- data.tar.gz: 976f7f282d3c6166828d8efe58f9eab018ab3065
3
+ metadata.gz: 622eab2c3d8d1c4d7260efd7731d0733877f7898
4
+ data.tar.gz: 6533fdaf33f2c48446228d31a21589100a9219c7
5
5
  SHA512:
6
- metadata.gz: 21318a7954bb56927b8737add30ac9e6614498fb3fbc69d604114b49ab84439e5989bdb4fddfc03c9fc6e4e239a1091fec7d61de3b3691c63daf886cb0b75ddb
7
- data.tar.gz: 48c417775418fa72d88a482c72407d9d97a86b0e7c534ab1f05544b39fba902cbdd6ea0b1602054d92ddd1eb23e1f44e239e740b3c79a65d7ad9bf689e4a577a
6
+ metadata.gz: 428cc72cf64692d4880645a0720d4e27bd6037289ac6692d1b41c797974e0cce1e0ef4a23d1c84575d36a9ae7f70d4f797651c4e76ffce6ccd4a28aee08bee81
7
+ data.tar.gz: e44fcf729a343a79759fdf80ce9d39e0994e20288ceba4ab5e4fa2ccee04b289a8a742a49740526c6619661c76aa1fe35a0dcd4d37ada9c75d349f691b3e4bdc
@@ -6,6 +6,6 @@
6
6
  %li
7
7
  = link_to(I18n.t('pugin.components.navigation-main.item_2'), house_members_current_a_z_letter_path(Parliament::Utils::Helpers::HousesHelper.lords_id, 'a'))
8
8
  %li
9
- = link_to(I18n.t('pugin.components.navigation-main.item_4'), constituencies_current_a_z_letter_path('a'))
9
+ = link_to(I18n.t('pugin.components.navigation-main.item_4'), find_your_constituency_path)
10
10
  %li
11
11
  = link_to(I18n.t('pugin.components.navigation-main.item_3'), house_parties_current_path(Parliament::Utils::Helpers::HousesHelper.commons_id))
@@ -20,5 +20,6 @@
20
20
  %p= I18n.t('pugin.constituencies.list.current_constituency.vacant').capitalize
21
21
  - else
22
22
  %h2
23
- %a{:href => "/constituencies/#{constituencies.graph_id}"}= "#{constituencies.name} (#{l(constituencies.start_date, format: :year_only)} - #{l(constituencies.end_date, format: :year_only)})"
23
+ - date_string = " (#{l(constituencies.start_date, format: :year_only)} - #{l(constituencies.end_date, format: :year_only)})" if constituencies.respond_to?(:start_date) && constituencies.respond_to?(:end_date)
24
+ %a{:href => "/constituencies/#{constituencies.graph_id}"}= "#{constituencies.name}#{date_string}"
24
25
  %p= "#{t('pugin.constituencies.list.former_constituency.former').capitalize} #{t('pugin.constituencies.list.former_constituency.constituency')}"
data/lib/pugin/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pugin
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
@@ -17,7 +17,7 @@ describe 'pugin/components/_navigation-main.html.haml', type: :view do
17
17
  allow(Parliament::Utils::Helpers::HousesHelper).to receive(:lords_id).and_return('456')
18
18
  allow(view).to receive(:mps_path).and_return("/mps")
19
19
  allow(view).to receive(:house_members_current_a_z_letter_path).and_return("houses/#{Parliament::Utils::Helpers::HousesHelper.lords_id}/members/current/a-z/a")
20
- allow(view).to receive(:constituencies_current_a_z_letter_path).and_return("constituencies/current/a-z/a")
20
+ allow(view).to receive(:find_your_constituency_path).and_return("/find-your-constituency")
21
21
  allow(view).to receive(:house_parties_current_path).and_return("houses/#{Parliament::Utils::Helpers::HousesHelper.commons_id}/parties/current/")
22
22
  end
23
23
 
@@ -26,7 +26,7 @@ describe 'pugin/components/_navigation-main.html.haml', type: :view do
26
26
  expect(rendered).to include("<nav aria-label='navigation' class='navigation--main'>")
27
27
  expect(rendered).to include('<a href="/mps">MPs</a>')
28
28
  expect(rendered).to include('<a href="houses/456/members/current/a-z/a">Lords</a>')
29
- expect(rendered).to include('<a href="constituencies/current/a-z/a">Constituencies</a>')
29
+ expect(rendered).to include('<a href="/find-your-constituency">Constituencies</a>')
30
30
  expect(rendered).to include('<a href="houses/123/parties/current/">Parties and groups</a>')
31
31
  end
32
32
  end
@@ -71,22 +71,64 @@ describe 'pugin/constituencies/list/_list.html.haml', type: :view do
71
71
 
72
72
  context 'with a previous constituency data set' do
73
73
 
74
- before :each do
75
- constituency = Class.new
76
- allow(constituency).to receive(:current?).and_return(false)
77
- allow(constituency).to receive(:name).and_return('Aberavon')
78
- allow(constituency).to receive(:graph_id).and_return('123')
79
- allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
80
- allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
74
+ context 'with full date' do
75
+ before :each do
76
+ constituency = Class.new
77
+ allow(constituency).to receive(:current?).and_return(false)
78
+ allow(constituency).to receive(:name).and_return('Aberavon')
79
+ allow(constituency).to receive(:graph_id).and_return('123')
80
+ allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
81
+ allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
81
82
 
82
- @constituencies = [constituency]
83
+ @constituencies = [constituency]
84
+ end
85
+
86
+ it 'displays the previous constituency i18n message' do
87
+ render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
88
+ expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon (1929 - 1950)</a>\n</h2>")
89
+ expect(response).to include("<p>Former constituency</p>")
90
+ end
83
91
  end
84
92
 
85
- it 'displays the previous constituency i18n message' do
86
- render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
87
- expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon (1929 - 1950)</a>\n</h2>")
88
- expect(response).to include("<p>Former constituency</p>")
93
+ context 'with partial date' do
94
+ # should never actually happen as current is based on start without end
95
+ context 'only start' do
96
+ before :each do
97
+ constituency = Class.new
98
+ allow(constituency).to receive(:current?).and_return(false)
99
+ allow(constituency).to receive(:name).and_return('Aberavon')
100
+ allow(constituency).to receive(:graph_id).and_return('123')
101
+ allow(constituency).to receive(:start_date).and_return(DateTime.new(1929))
102
+
103
+ @constituencies = [constituency]
104
+ end
105
+
106
+ it 'displays the previous constituency i18n message' do
107
+ render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
108
+ expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon</a>\n</h2>")
109
+ expect(response).to include("<p>Former constituency</p>")
110
+ end
111
+ end
112
+
113
+ context 'only end' do
114
+ before :each do
115
+ constituency = Class.new
116
+ allow(constituency).to receive(:current?).and_return(false)
117
+ allow(constituency).to receive(:name).and_return('Aberavon')
118
+ allow(constituency).to receive(:graph_id).and_return('123')
119
+ allow(constituency).to receive(:end_date).and_return(DateTime.new(1950))
120
+
121
+ @constituencies = [constituency]
122
+ end
123
+
124
+ it 'displays the previous constituency i18n message' do
125
+ render partial: "pugin/constituencies/list/list", collection: @constituencies, as: "constituencies".to_sym
126
+ expect(response).to include("<h2>\n<a href='/constituencies/123'>Aberavon</a>\n</h2>")
127
+ expect(response).to include("<p>Former constituency</p>")
128
+ end
129
+ end
89
130
  end
131
+
90
132
  end
91
133
 
92
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Rayner