ama_layout 6.3.0.pre → 6.10.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/ama_layout.gemspec +22 -20
  4. data/app/assets/javascripts/ama_layout/desktop/foundation-custom.js +10 -8
  5. data/app/assets/javascripts/ama_layout/desktop/index.js +1 -0
  6. data/app/assets/javascripts/ama_layout/notifications.coffee +17 -0
  7. data/app/controllers/ama_layout/api/v1/notifications_controller.rb +18 -0
  8. data/app/helpers/ama_layout_path_helper.rb +4 -4
  9. data/app/views/ama_layout/_notification.html.erb +10 -0
  10. data/app/views/ama_layout/_notification_sidebar.html.erb +22 -0
  11. data/app/views/ama_layout/_notifications.html.erb +6 -0
  12. data/app/views/ama_layout/_siteheader.html.erb +8 -3
  13. data/config/routes.rb +9 -0
  14. data/lib/ama_layout.rb +27 -20
  15. data/lib/ama_layout/decorators/navigation_decorator.rb +47 -0
  16. data/lib/ama_layout/decorators/notification_decorator.rb +45 -0
  17. data/lib/ama_layout/navigation.rb +3 -0
  18. data/lib/ama_layout/navigation.yml +58 -6
  19. data/lib/ama_layout/navigation_helper.rb +31 -0
  20. data/lib/ama_layout/notification.rb +89 -0
  21. data/lib/ama_layout/notification_scrubber.rb +13 -0
  22. data/lib/ama_layout/notification_set.rb +140 -0
  23. data/lib/ama_layout/notifications.rb +73 -0
  24. data/lib/ama_layout/notifications/abstract_store.rb +17 -0
  25. data/lib/ama_layout/notifications/redis_store.rb +38 -0
  26. data/lib/ama_layout/version.rb +1 -1
  27. data/spec/ama_layout/controllers/ama_layout/api/v1/notifications_controller_spec.rb +13 -0
  28. data/spec/ama_layout/decorators/navigation_decorator_spec.rb +121 -2
  29. data/spec/ama_layout/decorators/notification_decorator_spec.rb +57 -0
  30. data/spec/ama_layout/navigation_helper_spec.rb +63 -0
  31. data/spec/ama_layout/navigation_spec.rb +13 -43
  32. data/spec/ama_layout/notification_scrubber_spec.rb +10 -0
  33. data/spec/ama_layout/notification_set_spec.rb +281 -0
  34. data/spec/ama_layout/notification_spec.rb +193 -0
  35. data/spec/ama_layout/notifications/abstract_store_spec.rb +23 -0
  36. data/spec/ama_layout/notifications/redis_store_spec.rb +94 -0
  37. data/spec/ama_layout/notifications_spec.rb +109 -0
  38. data/spec/factories/users.rb +35 -0
  39. data/spec/helpers/ama_layout_path_helper_spec.rb +6 -6
  40. data/spec/internal/app/controllers/application_controller.rb +21 -0
  41. data/spec/internal/config/routes.rb +1 -0
  42. data/spec/spec_helper.rb +9 -14
  43. data/spec/support/shared_examples/member_navigation.rb +105 -0
  44. metadata +81 -18
  45. data/styles.scss +0 -0
@@ -27,12 +27,6 @@ describe AmaLayoutPathHelper do
27
27
  end
28
28
  end
29
29
 
30
- describe "#youraccount_help_path" do
31
- it "returns the help path" do
32
- expect(helper.youraccount_help_path).to eq "#{youraccount_site}/help"
33
- end
34
- end
35
-
36
30
  describe "#youraccount_billing_path" do
37
31
  it "returns the billing path" do
38
32
  expect(helper.youraccount_billing_path).to eq "#{youraccount_site}/billing"
@@ -111,6 +105,12 @@ describe AmaLayoutPathHelper do
111
105
  end
112
106
  end
113
107
 
108
+ describe "#membership_renew_path" do
109
+ it "returns the membership renew path" do
110
+ expect(helper.membership_renew_path).to eq "#{membership_site}/renews/new"
111
+ end
112
+ end
113
+
114
114
  describe "#driveredonline_path" do
115
115
  it "returns the driveredonile path" do
116
116
  expect(helper.driveredonline_path).to eq "#{driveredonline_site}"
@@ -1,2 +1,23 @@
1
1
  class ApplicationController < ActionController::Base
2
+ class NotificationsStub
3
+ include Enumerable
4
+
5
+ def each
6
+ [OpenStruct.new(dismiss!: true)].each do |element|
7
+ yield element
8
+ end
9
+ end
10
+
11
+ def save
12
+ true
13
+ end
14
+ end
15
+
16
+ def require_login
17
+ @current_user = OpenStruct.new(notifications: NotificationsStub.new)
18
+ end
19
+
20
+ def current_user
21
+ @current_user
22
+ end
2
23
  end
@@ -1,4 +1,5 @@
1
1
  Rails.application.routes.draw do
2
+ mount AmaLayout::Engine, at: 'ama_layout'
2
3
  root 'pages#index'
3
4
  get '/pages', to: 'pages#index', as: 'pages'
4
5
  end
@@ -1,15 +1,16 @@
1
- require "simplecov"
2
- require "factory_girl"
3
- require "ama_layout"
4
- require "pry"
5
- require "rspec/rails"
6
- require "combustion"
1
+ require 'simplecov'
2
+ require 'factory_girl'
3
+ require 'ama_layout'
4
+ require 'pry'
5
+ require 'rspec/rails'
6
+ require 'combustion'
7
+ require 'timecop'
7
8
 
8
- ENV["RAILS_ENV"] ||= "test"
9
+ ENV['RAILS_ENV'] = 'test'
9
10
 
10
11
  Combustion.initialize! :all
11
12
 
12
- Dir["./spec/support/**/*.rb"].sort.each { |file| require file }
13
+ Dir['./spec/support/**/*.rb'].sort.each { |file| require file }
13
14
 
14
15
  FactoryGirl.find_definitions
15
16
 
@@ -17,12 +18,6 @@ ActionView::TestCase::TestController.instance_eval do
17
18
  helper Rails.application.routes.url_helpers
18
19
  end
19
20
 
20
- ActionView::TestCase::TestController.class_eval do
21
- def _routes
22
- Rails.application.routes
23
- end
24
- end
25
-
26
21
  Draper::ViewContext.test_strategy :fast
27
22
 
28
23
  RSpec.configure do |config|
@@ -0,0 +1,105 @@
1
+ shared_examples 'member_navigation' do
2
+
3
+ context 'overview' do
4
+ it 'has the correct overview text and url' do
5
+ expect(subject.items[0].text).to eq 'My Account Overview'
6
+ expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
7
+ end
8
+ end
9
+
10
+ context "membership" do
11
+ let(:membership_subnav) { subject.items[1].sub_nav }
12
+
13
+ it "returns the subnav items" do
14
+ length = membership_subnav.length
15
+
16
+ expect(membership_subnav[0].text).to eq 'Membership Overview'
17
+ expect(membership_subnav[0].link).to eq "#{membership_site}/membership/overview"
18
+
19
+ expect(membership_subnav[length - 3].text).to eq 'Manage Membership'
20
+ expect(membership_subnav[length - 3].link).to eq "#{membership_site}/membership/manage"
21
+
22
+ expect(membership_subnav[length - 2].text).to eq 'Billing Options'
23
+ expect(membership_subnav[length - 2].link).to eq "#{youraccount_site}/billing"
24
+
25
+ expect(membership_subnav.last.text).to eq 'Print/Request New Card'
26
+ expect(membership_subnav.last.link).to eq "#{youraccount_site}/membership"
27
+ end
28
+ end
29
+
30
+ context 'automotive' do
31
+ let(:automotive_subnav) { subject.items[2].sub_nav }
32
+
33
+ it 'returns the subnav items' do
34
+ expect(automotive_subnav[0].text).to eq 'Roadside Assistance Overview'
35
+ expect(automotive_subnav[0].link).to eq "#{automotive_site}/"
36
+ end
37
+ end
38
+
39
+ context 'driver education' do
40
+ let(:driver_education_subnav) { subject.items[3].sub_nav }
41
+
42
+ it 'return the subnav items' do
43
+ expect(driver_education_subnav[0].text).to eq 'Driver Education Overview'
44
+ expect(driver_education_subnav[0].link).to eq "#{driveredonline_site}/"
45
+
46
+ expect(driver_education_subnav[1].text).to eq 'New Driver Online Program'
47
+ expect(driver_education_subnav[1].link).to eq "#{driveredonline_site}/dashboard"
48
+ end
49
+ end
50
+
51
+ context 'rewards' do
52
+ let(:rewards_subnav) { subject.items[4].sub_nav }
53
+
54
+ it 'returns the subnav items' do
55
+ expect(rewards_subnav[0].text).to eq 'Rewards Overview'
56
+ expect(rewards_subnav[0].link).to eq "#{youraccount_site}/rewards"
57
+
58
+ expect(rewards_subnav[1].text).to eq 'Gift Cards'
59
+ expect(rewards_subnav[1].link).to eq "#{membership_site}/reward_cards"
60
+
61
+ expect(rewards_subnav[2].text).to eq 'Transaction History'
62
+ expect(rewards_subnav[2].link).to eq "#{youraccount_site}/reward_dollars"
63
+
64
+ expect(rewards_subnav[3].text).to eq 'Pizza 73 Coupon Codes'
65
+ expect(rewards_subnav[3].link).to eq "#{youraccount_site}/pizza73"
66
+ end
67
+ end
68
+
69
+ context 'registries' do
70
+ let(:registries_subnav) { subject.items[5].sub_nav }
71
+
72
+ it 'returns the subnav items' do
73
+ expect(registries_subnav[0].text).to eq 'Registries Overview'
74
+ expect(registries_subnav[0].link).to eq "#{registries_site}/"
75
+
76
+ expect(registries_subnav[1].text).to eq 'Vehicle Registration Auto-Renew'
77
+ expect(registries_subnav[1].link).to eq "#{registries_site}/order/registrations/new"
78
+ end
79
+ end
80
+
81
+ context 'travel' do
82
+ it 'has the correct travel text and url' do
83
+ expect(subject.items[6].text).to eq 'My Travel'
84
+ expect(subject.items[6].link).to eq "#{travel_site}"
85
+ end
86
+ end
87
+
88
+ context 'my account' do
89
+ let(:my_account_subnav) { subject.items[7].sub_nav }
90
+
91
+ it 'returns the subnav items' do
92
+ expect(my_account_subnav[0].text).to eq 'Change Email/Password'
93
+ expect(my_account_subnav[0].link).to eq "#{gatekeeper_site}/user/edit"
94
+
95
+ expect(my_account_subnav[1].text).to eq 'Email Subscriptions'
96
+ expect(my_account_subnav[1].link).to eq "#{youraccount_site}/subscriptions"
97
+
98
+ expect(my_account_subnav[2].text).to eq 'AMA Insider Magazine'
99
+ expect(my_account_subnav[2].link).to eq "#{youraccount_site}/amainsider"
100
+
101
+ expect(my_account_subnav[3].text).to eq 'Change Address'
102
+ expect(my_account_subnav[3].link).to eq "#{youraccount_site}/membership_update/new"
103
+ end
104
+ end
105
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ama_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0.pre
4
+ version: 6.10.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -18,22 +18,22 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2017-06-21 00:00:00.000000000 Z
21
+ date: 2017-08-02 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: foundation-rails
25
25
  requirement: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 6.3.1.0
29
+ version: 6.4.1.2
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - "~>"
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 6.3.1.0
36
+ version: 6.4.1.2
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rails
39
39
  requirement: !ruby/object:Gem::Requirement
@@ -66,16 +66,16 @@ dependencies:
66
66
  name: draper
67
67
  requirement: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
- version: 3.0.0.pre1
71
+ version: 3.0.0
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
- version: 3.0.0.pre1
78
+ version: 3.0.0
79
79
  - !ruby/object:Gem::Dependency
80
80
  name: browser
81
81
  requirement: !ruby/object:Gem::Requirement
@@ -94,16 +94,30 @@ dependencies:
94
94
  name: breadcrumbs_on_rails
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - "~>"
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
- version: 3.0.1
99
+ version: '3'
100
100
  type: :runtime
101
101
  prerelease: false
102
102
  version_requirements: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - "~>"
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '3'
107
+ - !ruby/object:Gem::Dependency
108
+ name: redis-rails
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ type: :runtime
115
+ prerelease: false
116
+ version_requirements: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
105
119
  - !ruby/object:Gem::Version
106
- version: 3.0.1
120
+ version: '0'
107
121
  - !ruby/object:Gem::Dependency
108
122
  name: bundler
109
123
  requirement: !ruby/object:Gem::Requirement
@@ -122,14 +136,14 @@ dependencies:
122
136
  name: rake
123
137
  requirement: !ruby/object:Gem::Requirement
124
138
  requirements:
125
- - - "~>"
139
+ - - ">="
126
140
  - !ruby/object:Gem::Version
127
141
  version: '11.0'
128
142
  type: :development
129
143
  prerelease: false
130
144
  version_requirements: !ruby/object:Gem::Requirement
131
145
  requirements:
132
- - - "~>"
146
+ - - ">="
133
147
  - !ruby/object:Gem::Version
134
148
  version: '11.0'
135
149
  - !ruby/object:Gem::Dependency
@@ -216,6 +230,20 @@ dependencies:
216
230
  - - ">="
217
231
  - !ruby/object:Gem::Version
218
232
  version: '0'
233
+ - !ruby/object:Gem::Dependency
234
+ name: timecop
235
+ requirement: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - ">="
238
+ - !ruby/object:Gem::Version
239
+ version: '0'
240
+ type: :development
241
+ prerelease: false
242
+ version_requirements: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - ">="
245
+ - !ruby/object:Gem::Version
246
+ version: '0'
219
247
  description: ".ama.ab.ca site layouts"
220
248
  email:
221
249
  - michael.beuken@gmail.com
@@ -257,8 +285,10 @@ files:
257
285
  - app/assets/javascripts/ama_layout/mobile/mobile_menu.coffee
258
286
  - app/assets/javascripts/ama_layout/mobile/ready.coffee
259
287
  - app/assets/javascripts/ama_layout/mobile/tablesaw.stackonly.js
288
+ - app/assets/javascripts/ama_layout/notifications.coffee
260
289
  - app/assets/javascripts/ama_layout/real_date_picker.coffee
261
290
  - app/config/locales/en.yml
291
+ - app/controllers/ama_layout/api/v1/notifications_controller.rb
262
292
  - app/helpers/ama_layout_breadcrumb_helper.rb
263
293
  - app/helpers/ama_layout_content_helper.rb
264
294
  - app/helpers/ama_layout_path_helper.rb
@@ -272,6 +302,9 @@ files:
272
302
  - app/views/ama_layout/_main_top_nav_item.html.erb
273
303
  - app/views/ama_layout/_notice.html.erb
274
304
  - app/views/ama_layout/_notices.html.erb
305
+ - app/views/ama_layout/_notification.html.erb
306
+ - app/views/ama_layout/_notification_sidebar.html.erb
307
+ - app/views/ama_layout/_notifications.html.erb
275
308
  - app/views/ama_layout/_sidebar.html.erb
276
309
  - app/views/ama_layout/_siteheader.html.erb
277
310
  - app/views/ama_layout/_sub_nav.html.erb
@@ -281,31 +314,50 @@ files:
281
314
  - app/views/ama_layout/_top_sub_nav.html.erb
282
315
  - app/views/ama_layout/_top_sub_nav_item.html.erb
283
316
  - app/views/application/_account_toggle.html.erb
317
+ - config/routes.rb
284
318
  - lib/ama_layout.rb
285
319
  - lib/ama_layout/breadcrumb_builder.rb
286
320
  - lib/ama_layout/controllers/action_controller.rb
287
321
  - lib/ama_layout/decorators/moneris_decorator.rb
288
322
  - lib/ama_layout/decorators/navigation_decorator.rb
289
323
  - lib/ama_layout/decorators/navigation_item_decorator.rb
324
+ - lib/ama_layout/decorators/notification_decorator.rb
290
325
  - lib/ama_layout/moneris.rb
291
326
  - lib/ama_layout/moneris/textbox.txt
292
327
  - lib/ama_layout/navigation.rb
293
328
  - lib/ama_layout/navigation.yml
329
+ - lib/ama_layout/navigation_helper.rb
294
330
  - lib/ama_layout/navigation_item.rb
331
+ - lib/ama_layout/notification.rb
332
+ - lib/ama_layout/notification_scrubber.rb
333
+ - lib/ama_layout/notification_set.rb
334
+ - lib/ama_layout/notifications.rb
335
+ - lib/ama_layout/notifications/abstract_store.rb
336
+ - lib/ama_layout/notifications/redis_store.rb
295
337
  - lib/ama_layout/version.rb
296
338
  - spec/ama_layout/breadcrumb_builder_spec.rb
339
+ - spec/ama_layout/controllers/ama_layout/api/v1/notifications_controller_spec.rb
297
340
  - spec/ama_layout/controllers/pages_controller_spec.rb
298
341
  - spec/ama_layout/decorators/moneris_decorator_spec.rb
299
342
  - spec/ama_layout/decorators/navigation_decorator_spec.rb
300
343
  - spec/ama_layout/decorators/navigation_item_decorator_spec.rb
344
+ - spec/ama_layout/decorators/notification_decorator_spec.rb
301
345
  - spec/ama_layout/fixtures/navigation.yml
302
346
  - spec/ama_layout/fixtures/real_date_picker.html
303
347
  - spec/ama_layout/javascripts/real_date_picker_spec.coffee
304
348
  - spec/ama_layout/moneris_spec.rb
349
+ - spec/ama_layout/navigation_helper_spec.rb
305
350
  - spec/ama_layout/navigation_item_spec.rb
306
351
  - spec/ama_layout/navigation_spec.rb
352
+ - spec/ama_layout/notification_scrubber_spec.rb
353
+ - spec/ama_layout/notification_set_spec.rb
354
+ - spec/ama_layout/notification_spec.rb
355
+ - spec/ama_layout/notifications/abstract_store_spec.rb
356
+ - spec/ama_layout/notifications/redis_store_spec.rb
357
+ - spec/ama_layout/notifications_spec.rb
307
358
  - spec/factories/navigation.rb
308
359
  - spec/factories/navigation_item.rb
360
+ - spec/factories/users.rb
309
361
  - spec/helpers/ama_layout_breadcrumb_helper_spec.rb
310
362
  - spec/helpers/ama_layout_content_helper_spec.rb
311
363
  - spec/helpers/ama_layout_path_helper_spec.rb
@@ -317,8 +369,8 @@ files:
317
369
  - spec/internal/log/.gitignore
318
370
  - spec/internal/public/favicon.ico
319
371
  - spec/spec_helper.rb
320
- - styles.scss
321
- homepage: ''
372
+ - spec/support/shared_examples/member_navigation.rb
373
+ homepage: https://github.com/amaabca/ama_layout
322
374
  licenses:
323
375
  - MIT
324
376
  metadata: {}
@@ -344,18 +396,28 @@ specification_version: 4
344
396
  summary: ".ama.ab.ca site layouts"
345
397
  test_files:
346
398
  - spec/ama_layout/breadcrumb_builder_spec.rb
399
+ - spec/ama_layout/controllers/ama_layout/api/v1/notifications_controller_spec.rb
347
400
  - spec/ama_layout/controllers/pages_controller_spec.rb
348
401
  - spec/ama_layout/decorators/moneris_decorator_spec.rb
349
402
  - spec/ama_layout/decorators/navigation_decorator_spec.rb
350
403
  - spec/ama_layout/decorators/navigation_item_decorator_spec.rb
404
+ - spec/ama_layout/decorators/notification_decorator_spec.rb
351
405
  - spec/ama_layout/fixtures/navigation.yml
352
406
  - spec/ama_layout/fixtures/real_date_picker.html
353
407
  - spec/ama_layout/javascripts/real_date_picker_spec.coffee
354
408
  - spec/ama_layout/moneris_spec.rb
409
+ - spec/ama_layout/navigation_helper_spec.rb
355
410
  - spec/ama_layout/navigation_item_spec.rb
356
411
  - spec/ama_layout/navigation_spec.rb
412
+ - spec/ama_layout/notification_scrubber_spec.rb
413
+ - spec/ama_layout/notification_set_spec.rb
414
+ - spec/ama_layout/notification_spec.rb
415
+ - spec/ama_layout/notifications/abstract_store_spec.rb
416
+ - spec/ama_layout/notifications/redis_store_spec.rb
417
+ - spec/ama_layout/notifications_spec.rb
357
418
  - spec/factories/navigation.rb
358
419
  - spec/factories/navigation_item.rb
420
+ - spec/factories/users.rb
359
421
  - spec/helpers/ama_layout_breadcrumb_helper_spec.rb
360
422
  - spec/helpers/ama_layout_content_helper_spec.rb
361
423
  - spec/helpers/ama_layout_path_helper_spec.rb
@@ -367,3 +429,4 @@ test_files:
367
429
  - spec/internal/log/.gitignore
368
430
  - spec/internal/public/favicon.ico
369
431
  - spec/spec_helper.rb
432
+ - spec/support/shared_examples/member_navigation.rb
File without changes