ama_layout 9.5.2 → 11.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +45 -0
- data/.ruby-version +1 -0
- data/Dangerfile +19 -0
- data/ama_layout.gemspec +33 -18
- data/app/assets/javascripts/ama_layout/desktop/foundation-custom.js +1 -0
- data/app/helpers/ama_layout_breadcrumb_helper.rb +7 -1
- data/app/helpers/ama_layout_content_helper.rb +28 -17
- data/app/helpers/ama_layout_partial_helper.rb +11 -0
- data/app/views/ama_layout/{_alert.html.erb → v2/_alert.html.erb} +0 -0
- data/app/views/ama_layout/{_applogo.html.erb → v2/_applogo.html.erb} +0 -0
- data/app/views/ama_layout/{_breadcrumbs.html.erb → v2/_breadcrumbs.html.erb} +0 -0
- data/app/views/ama_layout/{_custom_nav_links.html.erb → v2/_custom_nav_links.html.erb} +0 -0
- data/app/views/ama_layout/{_custom_sidebar.html.erb → v2/_custom_sidebar.html.erb} +0 -0
- data/app/views/ama_layout/v2/_font.html.erb +1 -0
- data/app/views/ama_layout/{_footer.html.erb → v2/_footer.html.erb} +0 -0
- data/app/views/ama_layout/{_main_nav_item.html.erb → v2/_main_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/{_main_top_nav_item.html.erb → v2/_main_top_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/v2/_member_links.html.erb +6 -0
- data/app/views/ama_layout/{_mobile_links.html.erb → v2/_mobile_links.html.erb} +0 -0
- data/app/views/ama_layout/{_mobile_notification_icon.html.erb → v2/_mobile_notification_icon.html.erb} +0 -0
- data/app/views/ama_layout/{_notice.html.erb → v2/_notice.html.erb} +0 -0
- data/app/views/ama_layout/{_notices.html.erb → v2/_notices.html.erb} +0 -0
- data/app/views/ama_layout/{_notification.html.erb → v2/_notification.html.erb} +0 -0
- data/app/views/ama_layout/{_notification_icon.html.erb → v2/_notification_icon.html.erb} +0 -0
- data/app/views/ama_layout/{_notification_sidebar.html.erb → v2/_notification_sidebar.html.erb} +1 -1
- data/app/views/ama_layout/{_sidebar.html.erb → v2/_sidebar.html.erb} +0 -0
- data/app/views/ama_layout/{_sign_out_link.html.erb → v2/_sign_out_link.html.erb} +1 -1
- data/app/views/ama_layout/{_siteheader.html.erb → v2/_siteheader.html.erb} +0 -0
- data/app/views/ama_layout/{_sub_nav.html.erb → v2/_sub_nav.html.erb} +0 -0
- data/app/views/ama_layout/{_sub_nav_item.html.erb → v2/_sub_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/{_success.html.erb → v2/_success.html.erb} +0 -0
- data/app/views/ama_layout/v2/_top_nav.html.erb +16 -0
- data/app/views/ama_layout/{_top_sub_nav.html.erb → v2/_top_sub_nav.html.erb} +0 -0
- data/app/views/ama_layout/{_top_sub_nav_item.html.erb → v2/_top_sub_nav_item.html.erb} +0 -0
- data/app/views/ama_layout/v3/_alert.html.erb +5 -0
- data/app/views/ama_layout/v3/_applogo.html.erb +3 -0
- data/app/views/ama_layout/v3/_breadcrumbs.html.erb +3 -0
- data/app/views/ama_layout/v3/_custom_nav_links.html.erb +0 -0
- data/app/views/ama_layout/v3/_custom_sidebar.html.erb +1 -0
- data/app/views/ama_layout/v3/_font.html.erb +2 -0
- data/app/views/ama_layout/v3/_footer.html.erb +69 -0
- data/app/views/ama_layout/v3/_main_nav_item.html.erb +6 -0
- data/app/views/ama_layout/v3/_main_top_nav_item.html.erb +4 -0
- data/app/views/ama_layout/v3/_member_links.html.erb +6 -0
- data/app/views/ama_layout/v3/_mobile_links.html.erb +22 -0
- data/app/views/ama_layout/v3/_mobile_notification_icon.html.erb +4 -0
- data/app/views/ama_layout/v3/_notice.html.erb +5 -0
- data/app/views/ama_layout/v3/_notices.html.erb +3 -0
- data/app/views/ama_layout/v3/_notification.html.erb +10 -0
- data/app/views/ama_layout/v3/_notification_icon.html.erb +6 -0
- data/app/views/ama_layout/v3/_notification_sidebar.html.erb +22 -0
- data/app/views/ama_layout/v3/_sidebar.html.erb +8 -0
- data/app/views/ama_layout/v3/_sign_out_link.html.erb +3 -0
- data/app/views/ama_layout/v3/_siteheader.html.erb +37 -0
- data/app/views/ama_layout/v3/_sub_nav.html.erb +3 -0
- data/app/views/ama_layout/v3/_sub_nav_item.html.erb +3 -0
- data/app/views/ama_layout/v3/_success.html.erb +5 -0
- data/app/views/ama_layout/v3/_top_nav.html.erb +16 -0
- data/app/views/ama_layout/v3/_top_sub_nav.html.erb +3 -0
- data/app/views/ama_layout/v3/_top_sub_nav_item.html.erb +3 -0
- data/config.ru +9 -0
- data/lib/ama_layout/ama_layout_view.rb +6 -0
- data/lib/ama_layout/decorators/agent/navigation_decorator.rb +11 -6
- data/lib/ama_layout/decorators/navigation_decorator.rb +41 -26
- data/lib/ama_layout/draper_replacement.rb +6 -0
- data/lib/ama_layout/moneris.rb +10 -1
- data/lib/ama_layout/moneris/{textbox.txt → v2/textbox.txt} +0 -0
- data/lib/ama_layout/moneris/v3/textbox.txt +58 -0
- data/lib/ama_layout/navigation.rb +16 -9
- data/lib/ama_layout/navigation.yml +2 -2
- data/lib/ama_layout/version.rb +3 -1
- data/spec/ama_layout/decorators/moneris_decorator_spec.rb +4 -4
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +115 -60
- data/spec/ama_layout/moneris_spec.rb +22 -3
- data/spec/factories/agent_navigation.rb +3 -1
- data/spec/factories/navigation.rb +3 -1
- data/spec/factories/navigation_item.rb +6 -4
- data/spec/factories/users.rb +20 -13
- data/spec/helpers/ama_layout_content_helper_spec.rb +64 -62
- data/spec/internal/app/assets/config/manifest.js +0 -0
- data/spec/internal/db/schema.rb +4 -1
- data/spec/spec_helper.rb +3 -1
- metadata +108 -83
- data/.travis.yml +0 -6
- data/app/views/ama_layout/_top_nav.html.erb +0 -11
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AmaLayout
|
2
4
|
class Navigation
|
3
5
|
include ActiveModel::Model
|
@@ -14,44 +16,49 @@ module AmaLayout
|
|
14
16
|
end
|
15
17
|
|
16
18
|
cattr_accessor :member do
|
17
|
-
|
19
|
+
'member'
|
18
20
|
end
|
19
21
|
|
20
22
|
cattr_accessor :non_member do
|
21
|
-
|
23
|
+
'non-member'
|
22
24
|
end
|
23
25
|
|
24
26
|
cattr_accessor :member_in_renewal do
|
25
|
-
|
27
|
+
'member-in-renewal'
|
26
28
|
end
|
27
29
|
|
28
30
|
cattr_accessor :member_in_renewal_late do
|
29
|
-
|
31
|
+
'member-in-renewal-late'
|
30
32
|
end
|
31
33
|
|
32
34
|
cattr_accessor :member_with_outstanding_balance do
|
33
|
-
|
35
|
+
'member-with-outstanding-balance'
|
34
36
|
end
|
35
37
|
|
36
38
|
def items
|
37
39
|
navigation_items.fetch(user.try(:navigation), []).map do |n|
|
38
|
-
NavigationItem.new n.merge(
|
40
|
+
NavigationItem.new n.merge(current_url: current_url)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
def navigation_items
|
43
|
-
YAML.
|
45
|
+
YAML.safe_load(ERB.new(File.read(nav_file_path)).result)
|
44
46
|
end
|
45
47
|
|
46
48
|
def email
|
47
49
|
user.email
|
48
50
|
end
|
49
51
|
|
50
|
-
|
52
|
+
private
|
51
53
|
|
52
54
|
def defaults
|
53
55
|
{
|
54
|
-
nav_file_path: File.join(
|
56
|
+
nav_file_path: File.join(
|
57
|
+
Gem.loaded_specs['ama_layout'].full_gem_path,
|
58
|
+
'lib',
|
59
|
+
'ama_layout',
|
60
|
+
'navigation.yml'
|
61
|
+
)
|
55
62
|
}
|
56
63
|
end
|
57
64
|
end
|
@@ -51,7 +51,7 @@ member:
|
|
51
51
|
- text: "My Travel"
|
52
52
|
link: "<%= Rails.configuration.travel_login_url %>"
|
53
53
|
- text: "My Account Settings"
|
54
|
-
link: "<%= Rails.configuration.gatekeeper_site %>/
|
54
|
+
link: "<%= Rails.configuration.gatekeeper_site %>/account_settings"
|
55
55
|
icon: "fa-cogs"
|
56
56
|
sub_nav:
|
57
57
|
- text: "Change Email/Password"
|
@@ -136,7 +136,7 @@ member-in-renewal:
|
|
136
136
|
- text: "My Travel"
|
137
137
|
link: "<%= Rails.configuration.travel_login_url %>"
|
138
138
|
- text: "My Account Settings"
|
139
|
-
link: "<%= Rails.configuration.gatekeeper_site %>/
|
139
|
+
link: "<%= Rails.configuration.gatekeeper_site %>/account_settings"
|
140
140
|
icon: "fa-cogs"
|
141
141
|
sub_nav:
|
142
142
|
- text: "Change Email/Password"
|
data/lib/ama_layout/version.rb
CHANGED
@@ -14,7 +14,7 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
14
14
|
expect(moneris_presenter.textbox).to include "-webkit-user-select: text;"
|
15
15
|
expect(moneris_presenter.textbox).to include "-webkit-writing-mode: horizontal-tb;"
|
16
16
|
expect(moneris_presenter.textbox).to include "background-color: rgb(255, 255, 255);"
|
17
|
-
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(
|
17
|
+
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(160, 160, 161);"
|
18
18
|
expect(moneris_presenter.textbox).to include "border-bottom-style: solid;"
|
19
19
|
expect(moneris_presenter.textbox).to include "border-bottom-width: 2px;"
|
20
20
|
expect(moneris_presenter.textbox).to include "border-image-outset: 0px;"
|
@@ -22,13 +22,13 @@ describe AmaLayout::MonerisDecorator, type: :decorator do
|
|
22
22
|
expect(moneris_presenter.textbox).to include "border-image-slice: 100%;"
|
23
23
|
expect(moneris_presenter.textbox).to include "border-image-source: none;"
|
24
24
|
expect(moneris_presenter.textbox).to include "border-image-width: 1;"
|
25
|
-
expect(moneris_presenter.textbox).to include "border-left-color: rgb(
|
25
|
+
expect(moneris_presenter.textbox).to include "border-left-color: rgb(160, 160, 161)"
|
26
26
|
expect(moneris_presenter.textbox).to include "border-left-style: solid;"
|
27
27
|
expect(moneris_presenter.textbox).to include "border-left-width: 2px;"
|
28
|
-
expect(moneris_presenter.textbox).to include "border-right-color: rgb(
|
28
|
+
expect(moneris_presenter.textbox).to include "border-right-color: rgb(160, 160, 161)"
|
29
29
|
expect(moneris_presenter.textbox).to include "border-right-style: solid;"
|
30
30
|
expect(moneris_presenter.textbox).to include "border-right-width: 2px;"
|
31
|
-
expect(moneris_presenter.textbox).to include "border-top-color: rgb(
|
31
|
+
expect(moneris_presenter.textbox).to include "border-top-color: rgb(160, 160, 161)"
|
32
32
|
expect(moneris_presenter.textbox).to include "border-top-style: solid;"
|
33
33
|
expect(moneris_presenter.textbox).to include "border-top-width: 2px;"
|
34
34
|
expect(moneris_presenter.textbox).to include "box-shadow: none;"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
describe AmaLayout::NavigationDecorator do
|
2
4
|
let(:navigation) { FactoryBot.build(:navigation) }
|
3
5
|
let(:navigation_presenter) { navigation.decorate }
|
@@ -15,53 +17,53 @@ describe AmaLayout::NavigationDecorator do
|
|
15
17
|
Rails.configuration.amaabca_site = 'http://test.ama.ab.ca/'
|
16
18
|
end
|
17
19
|
|
18
|
-
describe
|
20
|
+
describe '#display_name_text' do
|
19
21
|
let(:user) { OpenStruct.new(email: 'john.doe@test.com') }
|
20
22
|
|
21
|
-
context
|
22
|
-
let(:name) {
|
23
|
+
context 'name is provided' do
|
24
|
+
let(:name) { 'John D' }
|
23
25
|
let(:nav) { AmaLayout::Navigation.new(user: user, display_name: name).decorate }
|
24
26
|
|
25
|
-
it
|
26
|
-
expect(nav.display_name_text).to eq
|
27
|
+
it 'has a welcome message' do
|
28
|
+
expect(nav.display_name_text).to eq('Welcome, John D')
|
27
29
|
end
|
28
30
|
|
29
|
-
context
|
30
|
-
let(:name) {
|
31
|
+
context 'long name given' do
|
32
|
+
let(:name) { 'A Really Really Really Really Long Name' }
|
31
33
|
|
32
|
-
it
|
33
|
-
expect(nav.display_name_text).to eq
|
34
|
+
it 'trucates to a total of 30 characters' do
|
35
|
+
expect(nav.display_name_text).to eq("Welcome, #{name.titleize}".truncate(30))
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
38
|
-
context
|
40
|
+
context 'name is not provided' do
|
39
41
|
let(:nav) { AmaLayout::Navigation.new(user: user).decorate }
|
40
42
|
|
41
|
-
it
|
42
|
-
expect(nav.display_name_text).to eq
|
43
|
+
it 'returns the email address' do
|
44
|
+
expect(nav.display_name_text).to eq(user.email)
|
43
45
|
end
|
44
46
|
|
45
|
-
context
|
47
|
+
context 'a really long email' do
|
46
48
|
let(:user) { OpenStruct.new(email: 'areallyreallyreallylongemail@test.com') }
|
47
49
|
|
48
|
-
it
|
49
|
-
expect(nav.display_name_text).to eq
|
50
|
+
it 'trucates to a total of 30 characters' do
|
51
|
+
expect(nav.display_name_text).to eq(user.email.truncate(30))
|
50
52
|
end
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
55
|
-
describe
|
57
|
+
describe '#items' do
|
56
58
|
before(:each) do
|
57
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
59
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
58
60
|
end
|
59
61
|
|
60
|
-
it
|
62
|
+
it 'returns an array of navigation items' do
|
61
63
|
expect(navigation_presenter.items).to be_an Array
|
62
64
|
end
|
63
65
|
|
64
|
-
it
|
66
|
+
it 'array contains decorated navigation items' do
|
65
67
|
items = navigation_presenter.items
|
66
68
|
items.each do |i|
|
67
69
|
expect(i).to be_a AmaLayout::NavigationItemDecorator
|
@@ -76,7 +78,7 @@ describe AmaLayout::NavigationDecorator do
|
|
76
78
|
end
|
77
79
|
|
78
80
|
it 'returns nil' do
|
79
|
-
expect(navigation_presenter.mobile_links).to
|
81
|
+
expect(navigation_presenter.mobile_links).to eq('')
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
@@ -87,71 +89,124 @@ describe AmaLayout::NavigationDecorator do
|
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
90
|
-
describe
|
91
|
-
context
|
92
|
-
it
|
93
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
94
|
-
expect(navigation_presenter.sign_out_link).to include
|
92
|
+
describe '#sign_out_link' do
|
93
|
+
context 'with user' do
|
94
|
+
it 'returns link' do
|
95
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
96
|
+
expect(navigation_presenter.sign_out_link).to include('Sign Out')
|
95
97
|
end
|
96
98
|
end
|
97
99
|
|
98
|
-
context
|
99
|
-
it
|
100
|
-
expect(navigation_presenter.sign_out_link).to eq
|
100
|
+
context 'without user' do
|
101
|
+
it 'does not return the link' do
|
102
|
+
expect(navigation_presenter.sign_out_link).to eq('')
|
101
103
|
end
|
102
104
|
end
|
103
105
|
end
|
104
106
|
|
105
|
-
describe
|
106
|
-
context
|
107
|
-
it
|
108
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
109
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
110
|
-
expect(navigation_presenter.top_nav).to eq
|
107
|
+
describe '#top_nav' do
|
108
|
+
context 'with items' do
|
109
|
+
it 'renders the partial' do
|
110
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
111
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
112
|
+
expect(navigation_presenter.top_nav).to eq('render')
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
114
|
-
context
|
115
|
-
it
|
116
|
-
expect(navigation_presenter.top_nav).to eq
|
116
|
+
context 'without items' do
|
117
|
+
it 'does not renders the partial' do
|
118
|
+
expect(navigation_presenter.top_nav).to eq('')
|
117
119
|
end
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
121
|
-
describe
|
122
|
-
context
|
123
|
-
it
|
124
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
125
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
126
|
-
expect(navigation_presenter.sidebar).to eq
|
123
|
+
describe '#sidebar' do
|
124
|
+
context 'with items' do
|
125
|
+
it 'renders the partial' do
|
126
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
127
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
128
|
+
expect(navigation_presenter.sidebar).to eq('render')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'without items' do
|
133
|
+
it 'does not renders the partial' do
|
134
|
+
expect(navigation_presenter.sidebar).to eq('')
|
127
135
|
end
|
128
136
|
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe '#member_links' do
|
140
|
+
let(:navigation) { FactoryBot.build(:navigation, user: user) }
|
141
|
+
let(:member_links) { navigation_presenter.member_links }
|
142
|
+
|
143
|
+
context 'nil user' do
|
144
|
+
let(:user) {}
|
145
|
+
|
146
|
+
it 'returns nothing' do
|
147
|
+
expect(member_links).to eq('')
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'non_member' do
|
152
|
+
let(:user) { FactoryBot.build(:user, :non_member) }
|
153
|
+
|
154
|
+
it 'returns nothing' do
|
155
|
+
expect(member_links).to eq('')
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
context 'status AL' do
|
160
|
+
let(:user) { FactoryBot.build(:user, :in_renewal_late) }
|
161
|
+
|
162
|
+
it 'returns nothing' do
|
163
|
+
expect(member_links).to eq('')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
context 'outstanding balance' do
|
168
|
+
let(:user) { FactoryBot.build(:user, :outstanding_balance) }
|
169
|
+
|
170
|
+
it 'returns the manage credit cards link' do
|
171
|
+
expect(member_links).to include('Manage Credit Cards')
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'member' do
|
176
|
+
let(:user) { FactoryBot.build(:user) }
|
177
|
+
|
178
|
+
it 'returns the manage credit cards link' do
|
179
|
+
expect(member_links).to include('Manage Credit Cards')
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context 'in renewal' do
|
184
|
+
let(:user) { FactoryBot.build(:user, :in_renewal) }
|
129
185
|
|
130
|
-
|
131
|
-
|
132
|
-
expect(navigation_presenter.sidebar).to eq nil
|
186
|
+
it 'returns the manage credit cards link' do
|
187
|
+
expect(member_links).to include('Manage Credit Cards')
|
133
188
|
end
|
134
189
|
end
|
135
190
|
end
|
136
191
|
|
137
|
-
context
|
138
|
-
it
|
139
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
140
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
141
|
-
expect(navigation_presenter.account_toggle).to eq
|
192
|
+
context 'account toggle' do
|
193
|
+
it 'in ama_layout it renders a blank partial' do
|
194
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
195
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
196
|
+
expect(navigation_presenter.account_toggle).to eq('render')
|
142
197
|
end
|
143
198
|
|
144
|
-
it
|
145
|
-
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation:
|
146
|
-
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return
|
147
|
-
expect(navigation_presenter.account_toggle).to eq
|
199
|
+
it 'in ama_layout it renders a blank partial' do
|
200
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
|
201
|
+
allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return 'render'
|
202
|
+
expect(navigation_presenter.account_toggle).to eq('render')
|
148
203
|
end
|
149
204
|
end
|
150
205
|
|
151
|
-
describe
|
152
|
-
context
|
153
|
-
it
|
154
|
-
expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq
|
206
|
+
describe 'ama layout view' do
|
207
|
+
context 'needed to allow rendering based on the view main app' do
|
208
|
+
it 'attaches additional methods to current decorator - draper is capable of the same thing' do
|
209
|
+
expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq('Bruce Wayne')
|
155
210
|
end
|
156
211
|
end
|
157
212
|
end
|
@@ -217,7 +272,7 @@ describe AmaLayout::NavigationDecorator do
|
|
217
272
|
end
|
218
273
|
|
219
274
|
it 'does not return the badge markup' do
|
220
|
-
expect(subject.notification_badge).to
|
275
|
+
expect(subject.notification_badge).to eq('')
|
221
276
|
end
|
222
277
|
end
|
223
278
|
|
@@ -1,8 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
describe AmaLayout::Moneris do
|
4
|
+
describe '#textbox_style_file' do
|
5
|
+
around(:each) do |example|
|
6
|
+
current_version = Rails.configuration.stylesheet_resolver.version
|
7
|
+
Rails.configuration.stylesheet_resolver.version = version
|
8
|
+
example.run
|
9
|
+
Rails.configuration.stylesheet_resolver.version = current_version
|
10
|
+
end
|
11
|
+
context 'v2' do
|
12
|
+
let(:version) { 'v2' }
|
13
|
+
|
14
|
+
it 'returns the correct file path' do
|
15
|
+
expect(subject.textbox_style_file).to include("lib/ama_layout/moneris/#{version}/textbox.txt")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'v3' do
|
20
|
+
let(:version) { 'v3' }
|
2
21
|
|
3
|
-
|
4
|
-
|
5
|
-
|
22
|
+
it 'returns the correct file path' do
|
23
|
+
expect(subject.textbox_style_file).to include("lib/ama_layout/moneris/#{version}/textbox.txt")
|
24
|
+
end
|
6
25
|
end
|
7
26
|
end
|
8
27
|
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.define do
|
2
4
|
factory :navigation_item, class: AmaLayout::NavigationItem do
|
3
|
-
text
|
4
|
-
icon
|
5
|
-
link
|
6
|
-
alt
|
5
|
+
text { 'Gotham Overview' }
|
6
|
+
icon { 'fa-tachometer' }
|
7
|
+
link { 'http://waffleemporium.ca/gotica' }
|
8
|
+
alt { 'Back to my dashboard' }
|
7
9
|
end
|
8
10
|
end
|
data/spec/factories/users.rb
CHANGED
@@ -1,35 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.define do
|
2
4
|
factory :user, class: Class.new(OpenStruct) do
|
3
|
-
in_renewal false
|
4
|
-
member_type 'P'
|
5
|
-
renew_type 'R'
|
6
|
-
status 'A'
|
7
|
-
has_outstanding_balance false
|
8
|
-
member? true
|
5
|
+
in_renewal { false }
|
6
|
+
member_type { 'P' }
|
7
|
+
renew_type { 'R' }
|
8
|
+
status { 'A' }
|
9
|
+
has_outstanding_balance { false }
|
10
|
+
member? { true }
|
11
|
+
menu_key { 'member' }
|
9
12
|
|
10
13
|
trait :non_member do
|
11
|
-
member? false
|
14
|
+
member? { false }
|
15
|
+
menu_key { 'non_member' }
|
12
16
|
end
|
13
17
|
|
14
18
|
trait :with_accr do
|
15
|
-
renew_type 'A'
|
19
|
+
renew_type { 'A' }
|
16
20
|
end
|
17
21
|
|
18
22
|
trait :with_mpp do
|
19
|
-
renew_type 'M'
|
23
|
+
renew_type { 'M' }
|
20
24
|
end
|
21
25
|
|
22
26
|
trait :in_renewal do
|
23
|
-
in_renewal true
|
27
|
+
in_renewal { true }
|
28
|
+
menu_key { 'member_renewal' }
|
24
29
|
end
|
25
30
|
|
26
31
|
trait :in_renewal_late do
|
27
|
-
in_renewal true
|
28
|
-
status 'AL'
|
32
|
+
in_renewal { true }
|
33
|
+
status { 'AL' }
|
34
|
+
menu_key { 'member_renewal_late' }
|
29
35
|
end
|
30
36
|
|
31
37
|
trait :outstanding_balance do
|
32
|
-
has_outstanding_balance true
|
38
|
+
has_outstanding_balance { true }
|
39
|
+
menu_key { 'member_outstanding_balance' }
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|