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 +4 -4
- data/app/views/pugin/components/_navigation-main.haml +1 -1
- data/app/views/pugin/constituencies/list/_list.html.haml +2 -1
- data/lib/pugin/version.rb +1 -1
- data/spec/views/pugin/components/_navigation-main.html.haml_spec.rb +2 -2
- data/spec/views/pugin/constituencies/list/_list.html.haml_spec.rb +54 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 622eab2c3d8d1c4d7260efd7731d0733877f7898
|
4
|
+
data.tar.gz: 6533fdaf33f2c48446228d31a21589100a9219c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'),
|
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
|
-
|
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
@@ -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(:
|
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="
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
-
|
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
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|