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.
Files changed (86) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +45 -0
  3. data/.ruby-version +1 -0
  4. data/Dangerfile +19 -0
  5. data/ama_layout.gemspec +33 -18
  6. data/app/assets/javascripts/ama_layout/desktop/foundation-custom.js +1 -0
  7. data/app/helpers/ama_layout_breadcrumb_helper.rb +7 -1
  8. data/app/helpers/ama_layout_content_helper.rb +28 -17
  9. data/app/helpers/ama_layout_partial_helper.rb +11 -0
  10. data/app/views/ama_layout/{_alert.html.erb → v2/_alert.html.erb} +0 -0
  11. data/app/views/ama_layout/{_applogo.html.erb → v2/_applogo.html.erb} +0 -0
  12. data/app/views/ama_layout/{_breadcrumbs.html.erb → v2/_breadcrumbs.html.erb} +0 -0
  13. data/app/views/ama_layout/{_custom_nav_links.html.erb → v2/_custom_nav_links.html.erb} +0 -0
  14. data/app/views/ama_layout/{_custom_sidebar.html.erb → v2/_custom_sidebar.html.erb} +0 -0
  15. data/app/views/ama_layout/v2/_font.html.erb +1 -0
  16. data/app/views/ama_layout/{_footer.html.erb → v2/_footer.html.erb} +0 -0
  17. data/app/views/ama_layout/{_main_nav_item.html.erb → v2/_main_nav_item.html.erb} +0 -0
  18. data/app/views/ama_layout/{_main_top_nav_item.html.erb → v2/_main_top_nav_item.html.erb} +0 -0
  19. data/app/views/ama_layout/v2/_member_links.html.erb +6 -0
  20. data/app/views/ama_layout/{_mobile_links.html.erb → v2/_mobile_links.html.erb} +0 -0
  21. data/app/views/ama_layout/{_mobile_notification_icon.html.erb → v2/_mobile_notification_icon.html.erb} +0 -0
  22. data/app/views/ama_layout/{_notice.html.erb → v2/_notice.html.erb} +0 -0
  23. data/app/views/ama_layout/{_notices.html.erb → v2/_notices.html.erb} +0 -0
  24. data/app/views/ama_layout/{_notification.html.erb → v2/_notification.html.erb} +0 -0
  25. data/app/views/ama_layout/{_notification_icon.html.erb → v2/_notification_icon.html.erb} +0 -0
  26. data/app/views/ama_layout/{_notification_sidebar.html.erb → v2/_notification_sidebar.html.erb} +1 -1
  27. data/app/views/ama_layout/{_sidebar.html.erb → v2/_sidebar.html.erb} +0 -0
  28. data/app/views/ama_layout/{_sign_out_link.html.erb → v2/_sign_out_link.html.erb} +1 -1
  29. data/app/views/ama_layout/{_siteheader.html.erb → v2/_siteheader.html.erb} +0 -0
  30. data/app/views/ama_layout/{_sub_nav.html.erb → v2/_sub_nav.html.erb} +0 -0
  31. data/app/views/ama_layout/{_sub_nav_item.html.erb → v2/_sub_nav_item.html.erb} +0 -0
  32. data/app/views/ama_layout/{_success.html.erb → v2/_success.html.erb} +0 -0
  33. data/app/views/ama_layout/v2/_top_nav.html.erb +16 -0
  34. data/app/views/ama_layout/{_top_sub_nav.html.erb → v2/_top_sub_nav.html.erb} +0 -0
  35. data/app/views/ama_layout/{_top_sub_nav_item.html.erb → v2/_top_sub_nav_item.html.erb} +0 -0
  36. data/app/views/ama_layout/v3/_alert.html.erb +5 -0
  37. data/app/views/ama_layout/v3/_applogo.html.erb +3 -0
  38. data/app/views/ama_layout/v3/_breadcrumbs.html.erb +3 -0
  39. data/app/views/ama_layout/v3/_custom_nav_links.html.erb +0 -0
  40. data/app/views/ama_layout/v3/_custom_sidebar.html.erb +1 -0
  41. data/app/views/ama_layout/v3/_font.html.erb +2 -0
  42. data/app/views/ama_layout/v3/_footer.html.erb +69 -0
  43. data/app/views/ama_layout/v3/_main_nav_item.html.erb +6 -0
  44. data/app/views/ama_layout/v3/_main_top_nav_item.html.erb +4 -0
  45. data/app/views/ama_layout/v3/_member_links.html.erb +6 -0
  46. data/app/views/ama_layout/v3/_mobile_links.html.erb +22 -0
  47. data/app/views/ama_layout/v3/_mobile_notification_icon.html.erb +4 -0
  48. data/app/views/ama_layout/v3/_notice.html.erb +5 -0
  49. data/app/views/ama_layout/v3/_notices.html.erb +3 -0
  50. data/app/views/ama_layout/v3/_notification.html.erb +10 -0
  51. data/app/views/ama_layout/v3/_notification_icon.html.erb +6 -0
  52. data/app/views/ama_layout/v3/_notification_sidebar.html.erb +22 -0
  53. data/app/views/ama_layout/v3/_sidebar.html.erb +8 -0
  54. data/app/views/ama_layout/v3/_sign_out_link.html.erb +3 -0
  55. data/app/views/ama_layout/v3/_siteheader.html.erb +37 -0
  56. data/app/views/ama_layout/v3/_sub_nav.html.erb +3 -0
  57. data/app/views/ama_layout/v3/_sub_nav_item.html.erb +3 -0
  58. data/app/views/ama_layout/v3/_success.html.erb +5 -0
  59. data/app/views/ama_layout/v3/_top_nav.html.erb +16 -0
  60. data/app/views/ama_layout/v3/_top_sub_nav.html.erb +3 -0
  61. data/app/views/ama_layout/v3/_top_sub_nav_item.html.erb +3 -0
  62. data/config.ru +9 -0
  63. data/lib/ama_layout/ama_layout_view.rb +6 -0
  64. data/lib/ama_layout/decorators/agent/navigation_decorator.rb +11 -6
  65. data/lib/ama_layout/decorators/navigation_decorator.rb +41 -26
  66. data/lib/ama_layout/draper_replacement.rb +6 -0
  67. data/lib/ama_layout/moneris.rb +10 -1
  68. data/lib/ama_layout/moneris/{textbox.txt → v2/textbox.txt} +0 -0
  69. data/lib/ama_layout/moneris/v3/textbox.txt +58 -0
  70. data/lib/ama_layout/navigation.rb +16 -9
  71. data/lib/ama_layout/navigation.yml +2 -2
  72. data/lib/ama_layout/version.rb +3 -1
  73. data/spec/ama_layout/decorators/moneris_decorator_spec.rb +4 -4
  74. data/spec/ama_layout/decorators/navigation_decorator_spec.rb +115 -60
  75. data/spec/ama_layout/moneris_spec.rb +22 -3
  76. data/spec/factories/agent_navigation.rb +3 -1
  77. data/spec/factories/navigation.rb +3 -1
  78. data/spec/factories/navigation_item.rb +6 -4
  79. data/spec/factories/users.rb +20 -13
  80. data/spec/helpers/ama_layout_content_helper_spec.rb +64 -62
  81. data/spec/internal/app/assets/config/manifest.js +0 -0
  82. data/spec/internal/db/schema.rb +4 -1
  83. data/spec/spec_helper.rb +3 -1
  84. metadata +108 -83
  85. data/.travis.yml +0 -6
  86. 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
- "member"
19
+ 'member'
18
20
  end
19
21
 
20
22
  cattr_accessor :non_member do
21
- "non-member"
23
+ 'non-member'
22
24
  end
23
25
 
24
26
  cattr_accessor :member_in_renewal do
25
- "member-in-renewal"
27
+ 'member-in-renewal'
26
28
  end
27
29
 
28
30
  cattr_accessor :member_in_renewal_late do
29
- "member-in-renewal-late"
31
+ 'member-in-renewal-late'
30
32
  end
31
33
 
32
34
  cattr_accessor :member_with_outstanding_balance do
33
- "member-with-outstanding-balance"
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({ current_url: current_url})
40
+ NavigationItem.new n.merge(current_url: current_url)
39
41
  end
40
42
  end
41
43
 
42
44
  def navigation_items
43
- YAML.load ERB.new(File.read nav_file_path).result
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
- private
52
+ private
51
53
 
52
54
  def defaults
53
55
  {
54
- nav_file_path: File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "navigation.yml")
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 %>/user/edit"
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 %>/user/edit"
139
+ link: "<%= Rails.configuration.gatekeeper_site %>/account_settings"
140
140
  icon: "fa-cogs"
141
141
  sub_nav:
142
142
  - text: "Change Email/Password"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AmaLayout
2
- VERSION = '9.5.2'
4
+ VERSION = '11.1.0'
3
5
  end
@@ -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(229, 229, 229);"
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(229, 229, 229);"
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(229, 229, 229);"
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(229, 229, 229);"
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 "#display_name_text" do
20
+ describe '#display_name_text' do
19
21
  let(:user) { OpenStruct.new(email: 'john.doe@test.com') }
20
22
 
21
- context "name is provided" do
22
- let(:name) { "John D" }
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 "has a welcome message" do
26
- expect(nav.display_name_text).to eq "Welcome, John D"
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 "long name given" do
30
- let(:name) { "A Really Really Really Really Long Name" }
31
+ context 'long name given' do
32
+ let(:name) { 'A Really Really Really Really Long Name' }
31
33
 
32
- it "trucates to a total of 30 characters" do
33
- expect(nav.display_name_text).to eq "Welcome, #{name.titleize}".truncate(30)
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 "name is not provided" do
40
+ context 'name is not provided' do
39
41
  let(:nav) { AmaLayout::Navigation.new(user: user).decorate }
40
42
 
41
- it "returns the user's email address" do
42
- expect(nav.display_name_text).to eq user.email
43
+ it 'returns the email address' do
44
+ expect(nav.display_name_text).to eq(user.email)
43
45
  end
44
46
 
45
- context "a really long email" do
47
+ context 'a really long email' do
46
48
  let(:user) { OpenStruct.new(email: 'areallyreallyreallylongemail@test.com') }
47
49
 
48
- it "trucates to a total of 30 characters" do
49
- expect(nav.display_name_text).to eq user.email.truncate(30)
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 "#items" do
57
+ describe '#items' do
56
58
  before(:each) do
57
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
59
+ allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: 'member'))
58
60
  end
59
61
 
60
- it "returns an array of navigation items" do
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 "array contains decorated navigation items" do
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 be_nil
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 "#sign_out_link" do
91
- context "with user" do
92
- it "returns link" do
93
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
94
- expect(navigation_presenter.sign_out_link).to include "Sign Out"
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 "without user" do
99
- it "does not return the link" do
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 "#top_nav" do
106
- context "with items" do
107
- it "renders the partial" do
108
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
109
- allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
110
- expect(navigation_presenter.top_nav).to eq "render"
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 "without items" do
115
- it "does not renders the partial" do
116
- expect(navigation_presenter.top_nav).to eq nil
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 "#sidebar" do
122
- context "with items" do
123
- it "renders the partial" do
124
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
125
- allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
126
- expect(navigation_presenter.sidebar).to eq "render"
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
- context "without items" do
131
- it "does not renders the partial" do
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 "account toggle" do
138
- it "in ama_layout it renders a blank partial" do
139
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
140
- allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
141
- expect(navigation_presenter.account_toggle).to eq "render"
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 "in ama_layout it renders a blank partial" do
145
- allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
146
- allow_any_instance_of(AmaLayout::AmaLayoutView).to receive(:render).and_return "render"
147
- expect(navigation_presenter.account_toggle).to eq "render"
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 "ama layout view" do
152
- context "needed to allow rendering based on the view main app" do
153
- it "attaches additional methods to current decorator - draper is capable of the same thing" do
154
- expect(navigation_presenter.h(Helpers::AttachMethodsSample.new).additional_info).to eq "Bruce Wayne"
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 be nil
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
- describe "#textbox_style_file" do
4
- it "return file path" do
5
- expect(subject.textbox_style_file).to include "lib/ama_layout/moneris/textbox.txt"
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,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  FactoryBot.define do
2
4
  factory :agent_navigation, class: AmaLayout::Agent::Navigation do
3
- current_url "http://waffleemporium.ca"
5
+ current_url { 'http://waffleemporium.ca' }
4
6
  end
5
7
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  FactoryBot.define do
2
4
  factory :navigation, class: AmaLayout::Navigation do
3
- current_url "http://waffleemporium.ca"
5
+ current_url { 'http://waffleemporium.ca' }
4
6
  end
5
7
  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 "Gotham Overview"
4
- icon "fa-tachometer"
5
- link "http://waffleemporium.ca/gotica"
6
- alt "Back to my dashboard"
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
@@ -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