ama_layout 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/Rakefile +4 -0
- data/ama_layout.gemspec +1 -0
- data/lib/ama_layout/navigation.yml +3 -0
- data/lib/ama_layout/version.rb +1 -1
- data/spec/ama_layout/decorators/moneris_decorator_spec.rb +70 -0
- data/spec/ama_layout/decorators/navigation_decorator_spec.rb +81 -0
- data/spec/ama_layout/decorators/navigation_item_decorator_spec.rb +85 -0
- data/spec/ama_layout/moneris_spec.rb +8 -0
- data/spec/ama_layout/navigation_item_spec.rb +21 -0
- data/spec/ama_layout/navigation_spec.rb +118 -0
- data/spec/factories/navigation.rb +5 -0
- data/spec/factories/navigation_item.rb +8 -0
- data/spec/helpers/ama_layout_content_helper_spec.rb +13 -1
- data/spec/helpers/ama_layout_path_helper_spec.rb +3 -3
- data/spec/spec_helper.rb +6 -0
- metadata +63 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4db5089973b6e7066f64cd9bf24940c808837cf
|
4
|
+
data.tar.gz: 9d455c9898557b73a5928816de78e0e559510708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31280142bcdeedd5e710990ae3e354578d1787ce7a4b047aef1fa5382d5830e591d178da22d55831f02c68f7601b0146126b7582f417ac7efdb2d8c0b1b8daf5
|
7
|
+
data.tar.gz: 7073014fafe17d148cdd61ec4bf37ff5f3b2f50cc07b516f5c5141c365dbd346e76aee2c6a24c619274455c9685cb253b5d8468f888c46799b430c46a364a167
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/ama_layout.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.7"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec-rails"
|
29
|
+
spec.add_development_dependency "factory_girl"
|
29
30
|
spec.add_development_dependency "simplecov"
|
30
31
|
spec.add_development_dependency "pry"
|
31
32
|
spec.add_development_dependency "combustion"
|
@@ -67,6 +67,9 @@ member-in-renewal-late:
|
|
67
67
|
alt: "Back to my dashboard"
|
68
68
|
link: "<%= Rails.configuration.gatekeeper_site %>/"
|
69
69
|
icon: "fa-tachometer"
|
70
|
+
- text: "Renew"
|
71
|
+
link: "<%= Rails.configuration.youraccount_site %>/renew"
|
72
|
+
icon: "fa-credit-card"
|
70
73
|
- text: "Driver Education"
|
71
74
|
link: "<%= Rails.configuration.driveredonline_site %>"
|
72
75
|
icon: "fa-car"
|
data/lib/ama_layout/version.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
describe AmaLayout::MonerisDecorator, type: :decorator do
|
2
|
+
let(:moneris) { AmaLayout::Moneris.new }
|
3
|
+
let(:moneris_presenter) { moneris.decorate }
|
4
|
+
|
5
|
+
describe "#textbox" do
|
6
|
+
it "return textbox style file" do
|
7
|
+
expect(moneris_presenter.textbox).to include "-webkit-appearance: none;"
|
8
|
+
expect(moneris_presenter.textbox).to include "-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 2px 0px inset;"
|
9
|
+
expect(moneris_presenter.textbox).to include "-webkit-rtl-ordering: logical;"
|
10
|
+
expect(moneris_presenter.textbox).to include "-webkit-transition-delay: 0s, 0s;"
|
11
|
+
expect(moneris_presenter.textbox).to include "-webkit-transition-duration: 0.45s, 0.45s;"
|
12
|
+
expect(moneris_presenter.textbox).to include "-webkit-transition-property: box-shadow, border-color;"
|
13
|
+
expect(moneris_presenter.textbox).to include "-webkit-transition-timing-function: ease, ease-in-out;"
|
14
|
+
expect(moneris_presenter.textbox).to include "-webkit-user-select: text;"
|
15
|
+
expect(moneris_presenter.textbox).to include "-webkit-writing-mode: horizontal-tb;"
|
16
|
+
expect(moneris_presenter.textbox).to include "background-color: rgb(255, 255, 255);"
|
17
|
+
expect(moneris_presenter.textbox).to include "border-bottom-color: rgb(204, 204, 204);"
|
18
|
+
expect(moneris_presenter.textbox).to include "border-bottom-left-radius: 3px;"
|
19
|
+
expect(moneris_presenter.textbox).to include "border-bottom-right-radius: 3px;"
|
20
|
+
expect(moneris_presenter.textbox).to include "border-bottom-style: solid;"
|
21
|
+
expect(moneris_presenter.textbox).to include "border-bottom-width: 1px;"
|
22
|
+
expect(moneris_presenter.textbox).to include "border-image-outset: 0px;"
|
23
|
+
expect(moneris_presenter.textbox).to include "border-image-repeat: stretch;"
|
24
|
+
expect(moneris_presenter.textbox).to include "border-image-slice: 100%;"
|
25
|
+
expect(moneris_presenter.textbox).to include "border-image-source: none;"
|
26
|
+
expect(moneris_presenter.textbox).to include "border-image-width: 1;"
|
27
|
+
expect(moneris_presenter.textbox).to include "border-left-color: rgb(204, 204, 204);"
|
28
|
+
expect(moneris_presenter.textbox).to include "border-left-style: solid;"
|
29
|
+
expect(moneris_presenter.textbox).to include "border-left-width: 1px;"
|
30
|
+
expect(moneris_presenter.textbox).to include "border-right-color: rgb(204, 204, 204);"
|
31
|
+
expect(moneris_presenter.textbox).to include "border-right-style: solid;"
|
32
|
+
expect(moneris_presenter.textbox).to include "border-right-width: 1px;"
|
33
|
+
expect(moneris_presenter.textbox).to include "border-top-color: rgb(204, 204, 204);"
|
34
|
+
expect(moneris_presenter.textbox).to include "border-top-left-radius: 3px;"
|
35
|
+
expect(moneris_presenter.textbox).to include "border-top-right-radius: 3px;"
|
36
|
+
expect(moneris_presenter.textbox).to include "border-top-style: solid;"
|
37
|
+
expect(moneris_presenter.textbox).to include "border-top-width: 1px;"
|
38
|
+
expect(moneris_presenter.textbox).to include "box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 2px 0px inset;"
|
39
|
+
expect(moneris_presenter.textbox).to include "box-sizing: border-box;"
|
40
|
+
expect(moneris_presenter.textbox).to include "color: rgba(0, 0, 0, 0.74902);"
|
41
|
+
expect(moneris_presenter.textbox).to include "cursor: auto;"
|
42
|
+
expect(moneris_presenter.textbox).to include "display: block;"
|
43
|
+
expect(moneris_presenter.textbox).to include "font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;font-size: 14px;"
|
44
|
+
expect(moneris_presenter.textbox).to include "font-style: normal;font-variant: normal;"
|
45
|
+
expect(moneris_presenter.textbox).to include "font-weight: normal;"
|
46
|
+
expect(moneris_presenter.textbox).to include "height: 37px;"
|
47
|
+
expect(moneris_presenter.textbox).to include "letter-spacing: normal;"
|
48
|
+
expect(moneris_presenter.textbox).to include "line-height: normal;"
|
49
|
+
expect(moneris_presenter.textbox).to include "margin-bottom: 0px;"
|
50
|
+
expect(moneris_presenter.textbox).to include "margin-left: 0px;"
|
51
|
+
expect(moneris_presenter.textbox).to include "margin-right: 0px;"
|
52
|
+
expect(moneris_presenter.textbox).to include "margin-top: 0px;"
|
53
|
+
expect(moneris_presenter.textbox).to include "padding-bottom: 8px;"
|
54
|
+
expect(moneris_presenter.textbox).to include "padding-left: 8px;"
|
55
|
+
expect(moneris_presenter.textbox).to include "padding-right: 8px;"
|
56
|
+
expect(moneris_presenter.textbox).to include "padding-top: 8px;"
|
57
|
+
expect(moneris_presenter.textbox).to include "text-align: start;"
|
58
|
+
expect(moneris_presenter.textbox).to include "text-indent: 0px;"
|
59
|
+
expect(moneris_presenter.textbox).to include "text-shadow: none;"
|
60
|
+
expect(moneris_presenter.textbox).to include "text-transform: none;"
|
61
|
+
expect(moneris_presenter.textbox).to include "transition-delay: 0s, 0s;"
|
62
|
+
expect(moneris_presenter.textbox).to include "transition-duration: 0.45s, 0.45s;"
|
63
|
+
expect(moneris_presenter.textbox).to include "transition-property: box-shadow, border-color;"
|
64
|
+
expect(moneris_presenter.textbox).to include "transition-timing-function: ease, ease-in-out;"
|
65
|
+
expect(moneris_presenter.textbox).to include "width: 100%;"
|
66
|
+
expect(moneris_presenter.textbox).to include "word-spacing: 0px;"
|
67
|
+
expect(moneris_presenter.textbox).to include "writing-mode: lr-tb;"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
describe AmaLayout::NavigationDecorator do
|
2
|
+
let(:navigation) { FactoryGirl.build(:navigation) }
|
3
|
+
let(:navigation_presenter) { navigation.decorate }
|
4
|
+
let(:gatekeeper_site) { "http://auth.waffles.ca" }
|
5
|
+
let(:youraccount_site) { "http://youraccount.waffles.ca" }
|
6
|
+
let(:insurance_site) { "http://insurance.waffles.ca" }
|
7
|
+
let(:membership_site) { "http://membership.waffles.ca" }
|
8
|
+
let(:driveredonline_site) { "http://driveredonline.waffles.ca" }
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
allow(Rails.configuration).to receive(:gatekeeper_site).and_return(gatekeeper_site)
|
12
|
+
allow(Rails.configuration).to receive(:youraccount_site).and_return(youraccount_site)
|
13
|
+
allow(Rails.configuration).to receive(:insurance_site).and_return(insurance_site)
|
14
|
+
allow(Rails.configuration).to receive(:membership_site).and_return(membership_site)
|
15
|
+
allow(Rails.configuration).to receive(:driveredonline_site).and_return(driveredonline_site)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#items" do
|
19
|
+
before(:each) do
|
20
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns an array of navigation items" do
|
24
|
+
expect(navigation_presenter.items).to be_an Array
|
25
|
+
end
|
26
|
+
|
27
|
+
it "array contains decorated navigation items" do
|
28
|
+
items = navigation_presenter.items
|
29
|
+
items.each do |i|
|
30
|
+
expect(i).to be_a AmaLayout::NavigationItemDecorator
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#sign_out_link" do
|
36
|
+
context "with user" do
|
37
|
+
it "returns link" do
|
38
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
39
|
+
expect(navigation_presenter.sign_out_link).to include "Sign Out"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "without user" do
|
44
|
+
it "does not return the link" do
|
45
|
+
expect(navigation_presenter.sign_out_link).to eq ""
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#top_nav" do
|
51
|
+
context "with items" do
|
52
|
+
it "renders the partial" do
|
53
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
54
|
+
allow_any_instance_of(Draper::HelperProxy).to receive(:render).and_return "render"
|
55
|
+
expect(navigation_presenter.top_nav).to eq "render"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "without items" do
|
60
|
+
it "does not renders the partial" do
|
61
|
+
expect(navigation_presenter.top_nav).to eq nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "#sidebar" do
|
67
|
+
context "with items" do
|
68
|
+
it "renders the partial" do
|
69
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
70
|
+
allow_any_instance_of(Draper::HelperProxy).to receive(:render).and_return "render"
|
71
|
+
expect(navigation_presenter.sidebar).to eq "render"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context "without items" do
|
76
|
+
it "does not renders the partial" do
|
77
|
+
expect(navigation_presenter.sidebar).to eq nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
describe AmaLayout::NavigationItemDecorator do
|
2
|
+
let(:navigation_item) { FactoryGirl.build(:navigation_item) }
|
3
|
+
let(:navigation_item_presenter) { navigation_item.decorate }
|
4
|
+
let(:items) { [{ text: "Othersite Overview", link: "othersite.com"}] }
|
5
|
+
|
6
|
+
describe "#sub_nav" do
|
7
|
+
before(:each) do
|
8
|
+
navigation_item.sub_nav = items
|
9
|
+
end
|
10
|
+
|
11
|
+
it "returns an array of navigation items" do
|
12
|
+
expect(navigation_item_presenter.sub_nav).to be_an Array
|
13
|
+
end
|
14
|
+
|
15
|
+
it "array contains decorated navigation items" do
|
16
|
+
items = navigation_item_presenter.sub_nav
|
17
|
+
items.each do |i|
|
18
|
+
expect(i).to be_a AmaLayout::NavigationItemDecorator
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#sub_nav_class" do
|
24
|
+
context "with sub_nav" do
|
25
|
+
it "return the class" do
|
26
|
+
navigation_item.sub_nav = items
|
27
|
+
expect(navigation_item_presenter.sub_nav_class).to eq "has-dropdown"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "without sub_nav" do
|
32
|
+
it "does not returns the class" do
|
33
|
+
expect(navigation_item_presenter.sub_nav_class).to eq nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#top_sub_nav" do
|
39
|
+
context "with items" do
|
40
|
+
it "renders the partial" do
|
41
|
+
navigation_item.sub_nav = items
|
42
|
+
allow_any_instance_of(Draper::HelperProxy).to receive(:render).and_return "render"
|
43
|
+
expect(navigation_item_presenter.top_sub_nav).to eq "render"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "without items" do
|
48
|
+
it "does not renders the partial" do
|
49
|
+
expect(navigation_item_presenter.top_sub_nav).to eq nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe "#sidebar_sub_nav" do
|
55
|
+
context "with items" do
|
56
|
+
it "renders the partial" do
|
57
|
+
navigation_item.sub_nav = items
|
58
|
+
allow_any_instance_of(Draper::HelperProxy).to receive(:render).and_return "render"
|
59
|
+
expect(navigation_item_presenter.sidebar_sub_nav).to eq "render"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "without items" do
|
64
|
+
it "does not renders the partial" do
|
65
|
+
expect(navigation_item_presenter.sidebar_sub_nav).to eq nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "#active_class" do
|
71
|
+
context "with active_link" do
|
72
|
+
it "return the class" do
|
73
|
+
navigation_item.current_url = "othersite.com"
|
74
|
+
navigation_item.sub_nav = items
|
75
|
+
expect(navigation_item_presenter.active_class).to eq "activepage"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "without active_link" do
|
80
|
+
it "does not returns the class" do
|
81
|
+
expect(navigation_item_presenter.active_class).to eq nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
describe AmaLayout::NavigationItem do
|
2
|
+
let(:site_domain) { "http://waffleemporium.ca" }
|
3
|
+
|
4
|
+
describe "#initialize" do
|
5
|
+
it "returns a navigation item" do
|
6
|
+
params = { text: "Gotham Overview", icon: "fa-tachometer", link: "#{site_domain}/gotica", alt: "Back to my dashboard", current_url: "#{site_domain}" }
|
7
|
+
expect(AmaLayout::NavigationItem.new(params)).to be_a AmaLayout::NavigationItem
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#sub_nav" do
|
12
|
+
it "set the subnav" do
|
13
|
+
subject.current_url = "#{site_domain}"
|
14
|
+
items = [{ text: "Othersite Overview", link: "#{site_domain}/othersite"}]
|
15
|
+
subject.sub_nav = items
|
16
|
+
expect(subject.sub_nav).to be_an Array
|
17
|
+
expect(subject.sub_nav.first.link).to include items.first[:link]
|
18
|
+
expect(subject.sub_nav.first.text).to include items.first[:text]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
describe AmaLayout::Navigation do
|
2
|
+
let(:gatekeeper_site) { "http://auth.waffles.ca" }
|
3
|
+
let(:youraccount_site) { "http://youraccount.waffles.ca" }
|
4
|
+
let(:insurance_site) { "http://insurance.waffles.ca" }
|
5
|
+
let(:membership_site) { "http://membership.waffles.ca" }
|
6
|
+
let(:driveredonline_site) { "http://driveredonline.waffles.ca" }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
allow(Rails.configuration).to receive(:gatekeeper_site).and_return(gatekeeper_site)
|
10
|
+
allow(Rails.configuration).to receive(:youraccount_site).and_return(youraccount_site)
|
11
|
+
allow(Rails.configuration).to receive(:insurance_site).and_return(insurance_site)
|
12
|
+
allow(Rails.configuration).to receive(:membership_site).and_return(membership_site)
|
13
|
+
allow(Rails.configuration).to receive(:driveredonline_site).and_return(driveredonline_site)
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#items" do
|
17
|
+
context "member" do
|
18
|
+
before(:each) do
|
19
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member"))
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns member navigation items" do
|
23
|
+
expect(subject.items[0].text).to eq "My Account Overview"
|
24
|
+
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
25
|
+
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
26
|
+
expect(subject.items[0].icon).to eq "fa-tachometer"
|
27
|
+
|
28
|
+
expect(subject.items[1].text).to eq "My Membership"
|
29
|
+
expect(subject.items[1].link).to eq "#"
|
30
|
+
expect(subject.items[1].icon).to eq "fa-credit-card"
|
31
|
+
|
32
|
+
expect(subject.items[2].text).to eq "My Driver Education"
|
33
|
+
expect(subject.items[2].link).to eq "#{driveredonline_site}"
|
34
|
+
expect(subject.items[2].icon).to eq "fa-car"
|
35
|
+
|
36
|
+
expect(subject.items[3].text).to eq "My Reward Dollars"
|
37
|
+
expect(subject.items[3].link).to eq "#{youraccount_site}/reward_dollars"
|
38
|
+
expect(subject.items[3].icon).to eq "fa-usd"
|
39
|
+
|
40
|
+
expect(subject.items[4].text).to eq "Reload Esso Gift Cards"
|
41
|
+
expect(subject.items[4].link).to eq "#{membership_site}/reward_cards"
|
42
|
+
expect(subject.items[4].icon).to eq "fa-arrow-up"
|
43
|
+
|
44
|
+
expect(subject.items[5].text).to eq "My Account Settings"
|
45
|
+
expect(subject.items[5].link).to eq "#"
|
46
|
+
expect(subject.items[5].icon).to eq "fa-cogs"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "non-member" do
|
51
|
+
before(:each) do
|
52
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "non-member"))
|
53
|
+
end
|
54
|
+
|
55
|
+
it "returns non-member navigation items" do
|
56
|
+
expect(subject.items[0].text).to eq "Account Dashboard"
|
57
|
+
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
58
|
+
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
59
|
+
expect(subject.items[0].icon).to eq "fa-tachometer"
|
60
|
+
|
61
|
+
expect(subject.items[1].text).to eq "Join AMA"
|
62
|
+
expect(subject.items[1].alt).to eq "Join AMA"
|
63
|
+
expect(subject.items[1].link).to eq membership_site
|
64
|
+
expect(subject.items[1].icon).to eq "fa-credit-card"
|
65
|
+
|
66
|
+
expect(subject.items[2].text).to eq "Driver Education"
|
67
|
+
expect(subject.items[2].link).to eq "#{driveredonline_site}"
|
68
|
+
expect(subject.items[2].icon).to eq "fa-car"
|
69
|
+
|
70
|
+
expect(subject.items[3].text).to eq "Change Email/Password"
|
71
|
+
expect(subject.items[3].link).to eq "#{gatekeeper_site}/user/edit"
|
72
|
+
expect(subject.items[3].icon).to eq "fa-cogs"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context "member-in-renewal" do
|
77
|
+
before(:each) do
|
78
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member-in-renewal"))
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns member-in-renewal navigation items" do
|
82
|
+
expect(subject.items[0].text).to eq "Account Dashboard"
|
83
|
+
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
84
|
+
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
85
|
+
expect(subject.items[0].icon).to eq "fa-tachometer"
|
86
|
+
|
87
|
+
expect(subject.items[1].text).to eq "Renew"
|
88
|
+
expect(subject.items[1].link).to eq "#{youraccount_site}/renew"
|
89
|
+
expect(subject.items[1].icon).to eq "fa-credit-card"
|
90
|
+
|
91
|
+
expect(subject.items[2].text).to eq "Driver Education"
|
92
|
+
expect(subject.items[2].link).to eq "#{driveredonline_site}"
|
93
|
+
expect(subject.items[2].icon).to eq "fa-car"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "member-in-renewal-late" do
|
98
|
+
before(:each) do
|
99
|
+
allow_any_instance_of(AmaLayout::Navigation).to receive(:user).and_return(OpenStruct.new(navigation: "member-in-renewal-late"))
|
100
|
+
end
|
101
|
+
|
102
|
+
it "returns member-in-renewal-late navigation items" do
|
103
|
+
expect(subject.items[0].text).to eq "Account Dashboard"
|
104
|
+
expect(subject.items[0].alt).to eq "Back to my dashboard"
|
105
|
+
expect(subject.items[0].link).to eq "#{gatekeeper_site}/"
|
106
|
+
expect(subject.items[0].icon).to eq "fa-tachometer"
|
107
|
+
|
108
|
+
expect(subject.items[1].text).to eq "Renew"
|
109
|
+
expect(subject.items[1].link).to eq "#{youraccount_site}/renew"
|
110
|
+
expect(subject.items[1].icon).to eq "fa-credit-card"
|
111
|
+
|
112
|
+
expect(subject.items[2].text).to eq "Driver Education"
|
113
|
+
expect(subject.items[2].link).to eq driveredonline_site
|
114
|
+
expect(subject.items[2].icon).to eq "fa-car"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -3,6 +3,7 @@ describe AmaLayoutContentHelper do
|
|
3
3
|
let(:site_name) { "Waffle Emporium" }
|
4
4
|
let(:site_domain) { "http://waffleemporium.ca" }
|
5
5
|
let(:site_url) { "#{site_domain}/wafflesauce" }
|
6
|
+
let(:nav_item) { FactoryGirl.build(:navigation_item) }
|
6
7
|
|
7
8
|
describe "#greeting" do
|
8
9
|
it "returns the greeting set in the domain cookie" do
|
@@ -18,13 +19,24 @@ describe AmaLayoutContentHelper do
|
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
22
|
+
describe "#active_section" do
|
23
|
+
it "returns active if request include the path" do
|
24
|
+
allow_any_instance_of(ActionController::TestRequest).to receive(:fullpath).and_return("#{site_domain}/gotica")
|
25
|
+
expect(helper.active_section(nav_item)).to eq "activepage"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "returns nil if request does not include the path" do
|
29
|
+
expect(helper.active_section(nav_item)).to eq nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
21
33
|
describe "#active_page" do
|
22
34
|
before(:each) do
|
23
35
|
allow(helper.request).to receive(:fullpath).and_return(site_url)
|
24
36
|
end
|
25
37
|
|
26
38
|
it "returns active if the given path matches the request path" do
|
27
|
-
expect(helper.active_page(site_url)).to eq "
|
39
|
+
expect(helper.active_page(site_url)).to eq "activepage"
|
28
40
|
end
|
29
41
|
|
30
42
|
it "returns nothing if the given patch does not match the request path" do
|
@@ -10,7 +10,7 @@ describe AmaLayoutPathHelper do
|
|
10
10
|
allow(Rails.configuration).to receive(:youraccount_site).and_return(youraccount_site)
|
11
11
|
allow(Rails.configuration).to receive(:insurance_site).and_return(insurance_site)
|
12
12
|
allow(Rails.configuration).to receive(:membership_site).and_return(membership_site)
|
13
|
-
allow(Rails.configuration).to receive(:driveredonline_site).and_return(
|
13
|
+
allow(Rails.configuration).to receive(:driveredonline_site).and_return(driveredonline_site)
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#gatekeeper_profile_path" do
|
@@ -105,13 +105,13 @@ describe AmaLayoutPathHelper do
|
|
105
105
|
|
106
106
|
describe "#membership_path" do
|
107
107
|
it "returns the membership esso reload path" do
|
108
|
-
expect(helper.membership_esso_reload_path).to eq "#{membership_site}/
|
108
|
+
expect(helper.membership_esso_reload_path).to eq "#{membership_site}/reward_cards"
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "#driveredonline_path" do
|
113
113
|
it "returns the driveredonile path" do
|
114
|
-
expect(helper.driveredonline_path).to eq "#{driveredonline_site}
|
114
|
+
expect(helper.driveredonline_path).to eq "#{driveredonline_site}"
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "simplecov"
|
2
|
+
require "factory_girl"
|
2
3
|
require "ama_layout"
|
3
4
|
require "pry"
|
4
5
|
require "rspec/rails"
|
@@ -10,6 +11,8 @@ Combustion.initialize! :all
|
|
10
11
|
|
11
12
|
Dir["./spec/support/**/*.rb"].sort.each { |file| require file }
|
12
13
|
|
14
|
+
FactoryGirl.find_definitions
|
15
|
+
|
13
16
|
ActionView::TestCase::TestController.instance_eval do
|
14
17
|
helper Rails.application.routes.url_helpers
|
15
18
|
end
|
@@ -20,6 +23,9 @@ ActionView::TestCase::TestController.class_eval do
|
|
20
23
|
end
|
21
24
|
end
|
22
25
|
|
26
|
+
Draper::ViewContext.test_strategy :fast
|
27
|
+
|
23
28
|
RSpec.configure do |config|
|
29
|
+
config.infer_spec_type_from_file_location!
|
24
30
|
config.include Rails.application.routes.url_helpers
|
25
31
|
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: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael van den Beuken
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2015-11-
|
20
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: foundation-rails
|
@@ -37,157 +37,171 @@ dependencies:
|
|
37
37
|
name: rails
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '4'
|
50
50
|
- !ruby/object:Gem::Dependency
|
51
51
|
name: sass-rails
|
52
52
|
requirement: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: font-awesome-sass
|
66
66
|
requirement: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: draper
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - '>='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: bundler
|
94
94
|
requirement: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ~>
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '1.7'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - ~>
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '1.7'
|
106
106
|
- !ruby/object:Gem::Dependency
|
107
107
|
name: rake
|
108
108
|
requirement: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - ~>
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '10.0'
|
113
113
|
type: :development
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ~>
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '10.0'
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
121
|
name: rspec-rails
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - '>='
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
type: :development
|
128
128
|
prerelease: false
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
name: factory_girl
|
136
|
+
requirement: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
type: :development
|
142
|
+
prerelease: false
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - '>='
|
132
146
|
- !ruby/object:Gem::Version
|
133
147
|
version: '0'
|
134
148
|
- !ruby/object:Gem::Dependency
|
135
149
|
name: simplecov
|
136
150
|
requirement: !ruby/object:Gem::Requirement
|
137
151
|
requirements:
|
138
|
-
- -
|
152
|
+
- - '>='
|
139
153
|
- !ruby/object:Gem::Version
|
140
154
|
version: '0'
|
141
155
|
type: :development
|
142
156
|
prerelease: false
|
143
157
|
version_requirements: !ruby/object:Gem::Requirement
|
144
158
|
requirements:
|
145
|
-
- -
|
159
|
+
- - '>='
|
146
160
|
- !ruby/object:Gem::Version
|
147
161
|
version: '0'
|
148
162
|
- !ruby/object:Gem::Dependency
|
149
163
|
name: pry
|
150
164
|
requirement: !ruby/object:Gem::Requirement
|
151
165
|
requirements:
|
152
|
-
- -
|
166
|
+
- - '>='
|
153
167
|
- !ruby/object:Gem::Version
|
154
168
|
version: '0'
|
155
169
|
type: :development
|
156
170
|
prerelease: false
|
157
171
|
version_requirements: !ruby/object:Gem::Requirement
|
158
172
|
requirements:
|
159
|
-
- -
|
173
|
+
- - '>='
|
160
174
|
- !ruby/object:Gem::Version
|
161
175
|
version: '0'
|
162
176
|
- !ruby/object:Gem::Dependency
|
163
177
|
name: combustion
|
164
178
|
requirement: !ruby/object:Gem::Requirement
|
165
179
|
requirements:
|
166
|
-
- -
|
180
|
+
- - '>='
|
167
181
|
- !ruby/object:Gem::Version
|
168
182
|
version: '0'
|
169
183
|
type: :development
|
170
184
|
prerelease: false
|
171
185
|
version_requirements: !ruby/object:Gem::Requirement
|
172
186
|
requirements:
|
173
|
-
- -
|
187
|
+
- - '>='
|
174
188
|
- !ruby/object:Gem::Version
|
175
189
|
version: '0'
|
176
190
|
- !ruby/object:Gem::Dependency
|
177
191
|
name: sqlite3
|
178
192
|
requirement: !ruby/object:Gem::Requirement
|
179
193
|
requirements:
|
180
|
-
- -
|
194
|
+
- - '>='
|
181
195
|
- !ruby/object:Gem::Version
|
182
196
|
version: '0'
|
183
197
|
type: :development
|
184
198
|
prerelease: false
|
185
199
|
version_requirements: !ruby/object:Gem::Requirement
|
186
200
|
requirements:
|
187
|
-
- -
|
201
|
+
- - '>='
|
188
202
|
- !ruby/object:Gem::Version
|
189
203
|
version: '0'
|
190
|
-
description:
|
204
|
+
description: .ama.ab.ca site layouts
|
191
205
|
email:
|
192
206
|
- michael.beuken@gmail.com
|
193
207
|
- ruben.a.estevez@gmail.com
|
@@ -203,9 +217,10 @@ executables: []
|
|
203
217
|
extensions: []
|
204
218
|
extra_rdoc_files: []
|
205
219
|
files:
|
206
|
-
-
|
207
|
-
-
|
208
|
-
-
|
220
|
+
- .gitignore
|
221
|
+
- .rspec
|
222
|
+
- .simplecov
|
223
|
+
- .travis.yml
|
209
224
|
- Gemfile
|
210
225
|
- LICENSE.txt
|
211
226
|
- README.md
|
@@ -284,6 +299,14 @@ files:
|
|
284
299
|
- lib/ama_layout/navigation.yml
|
285
300
|
- lib/ama_layout/navigation_item.rb
|
286
301
|
- lib/ama_layout/version.rb
|
302
|
+
- spec/ama_layout/decorators/moneris_decorator_spec.rb
|
303
|
+
- spec/ama_layout/decorators/navigation_decorator_spec.rb
|
304
|
+
- spec/ama_layout/decorators/navigation_item_decorator_spec.rb
|
305
|
+
- spec/ama_layout/moneris_spec.rb
|
306
|
+
- spec/ama_layout/navigation_item_spec.rb
|
307
|
+
- spec/ama_layout/navigation_spec.rb
|
308
|
+
- spec/factories/navigation.rb
|
309
|
+
- spec/factories/navigation_item.rb
|
287
310
|
- spec/helpers/ama_layout_content_helper_spec.rb
|
288
311
|
- spec/helpers/ama_layout_path_helper_spec.rb
|
289
312
|
- spec/internal/config/database.yml
|
@@ -303,21 +326,29 @@ require_paths:
|
|
303
326
|
- lib
|
304
327
|
required_ruby_version: !ruby/object:Gem::Requirement
|
305
328
|
requirements:
|
306
|
-
- -
|
329
|
+
- - '>='
|
307
330
|
- !ruby/object:Gem::Version
|
308
331
|
version: '0'
|
309
332
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
310
333
|
requirements:
|
311
|
-
- -
|
334
|
+
- - '>='
|
312
335
|
- !ruby/object:Gem::Version
|
313
336
|
version: '0'
|
314
337
|
requirements: []
|
315
338
|
rubyforge_project:
|
316
|
-
rubygems_version: 2.
|
339
|
+
rubygems_version: 2.0.0
|
317
340
|
signing_key:
|
318
341
|
specification_version: 4
|
319
|
-
summary:
|
342
|
+
summary: .ama.ab.ca site layouts
|
320
343
|
test_files:
|
344
|
+
- spec/ama_layout/decorators/moneris_decorator_spec.rb
|
345
|
+
- spec/ama_layout/decorators/navigation_decorator_spec.rb
|
346
|
+
- spec/ama_layout/decorators/navigation_item_decorator_spec.rb
|
347
|
+
- spec/ama_layout/moneris_spec.rb
|
348
|
+
- spec/ama_layout/navigation_item_spec.rb
|
349
|
+
- spec/ama_layout/navigation_spec.rb
|
350
|
+
- spec/factories/navigation.rb
|
351
|
+
- spec/factories/navigation_item.rb
|
321
352
|
- spec/helpers/ama_layout_content_helper_spec.rb
|
322
353
|
- spec/helpers/ama_layout_path_helper_spec.rb
|
323
354
|
- spec/internal/config/database.yml
|