bootstrap-navbar 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 048ac7040b82f5137e124b8b88c643f29f201e02
4
- data.tar.gz: e136412ed6a30340559891cf75dd817017b0eb3f
3
+ metadata.gz: 39d96cc530fbfb4f919a8f6dfcafef9baa39f5c4
4
+ data.tar.gz: 437335478231cfe02af2f423cd90782fe7c8969d
5
5
  SHA512:
6
- metadata.gz: a386f61fc104b587b99477a2688abff2bef7763ef625e6534ab80a43a7b09d6356e93665f2d488ef8b38c2e143bb63c0d3b6ff51680f774334fa36797f8880c5
7
- data.tar.gz: e35fa7f421ba27835024c8639f731a4021968d38607d2e935979f61be794a6efd7ce5019fda1eb27c2f17a22432a493d9b2b8842a3dcc772fb7c432b732323e2
6
+ metadata.gz: 6288289ddefc98e80f50215bb7d728b0290044ecd74bcfd7056bd65bc971411770e7d9e1804cc02131eda053113e9f2dcec3c6a9dcebea12cbc3569b55edbfc6
7
+ data.tar.gz: 8f86fbc80f213f2547cc90de2915f32dabf8f50ecd1d45faff594cdda0af26c50d459b803513b5d9b12a2be44ebd327ad002469f0dee6f973c02123f619de08e
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard 'rspec', cli: '--drb --profile', all_after_pass: false do
1
+ guard 'rspec', cmd: 'bundle exec rspec', failed_mode: :none, all_after_pass: true, all_on_start: true do
2
2
  # Specs
3
3
  watch(%r(^spec/.+_spec\.rb$))
4
4
  watch('spec/spec_helper.rb') { 'spec' }
@@ -23,8 +23,12 @@ module BootstrapNavbar::Helpers
23
23
  end
24
24
 
25
25
  def current_url_or_sub_url?(url)
26
- normalized_path, normalized_current_path = [url, current_url].map do |url|
27
- URI.parse(url).path.sub(%r(/\z), '')
26
+ uri, current_uri = [url, current_url].map do |url|
27
+ URI.parse(url)
28
+ end
29
+ return false if !uri.host.nil? && uri.host != current_uri.host
30
+ normalized_path, normalized_current_path = [uri, current_uri].map do |uri|
31
+ uri.path.sub(%r(/\z), '')
28
32
  end
29
33
  if normalized_path.empty?
30
34
  normalized_current_path.empty?
@@ -1,3 +1,3 @@
1
1
  module BootstrapNavbar
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
@@ -121,7 +121,7 @@ describe BootstrapNavbar::Helpers::Bootstrap2 do
121
121
  end
122
122
 
123
123
  describe '#navbar_item' do
124
- it_behaves_like 'marking the menu items as active correctly'
124
+ it_behaves_like 'marking the navbar items as active correctly'
125
125
 
126
126
  context 'with root URL' do
127
127
  context 'with list item options' do
@@ -126,7 +126,7 @@ describe BootstrapNavbar::Helpers::Bootstrap3 do
126
126
  end
127
127
 
128
128
  describe '#navbar_item' do
129
- it_behaves_like 'marking the menu items as active correctly'
129
+ it_behaves_like 'marking the navbar items as active correctly'
130
130
 
131
131
  context 'without current URL' do
132
132
  it 'generates the correct HTML' do
@@ -17,9 +17,9 @@ module Helpers
17
17
  end
18
18
  end
19
19
 
20
- shared_examples 'marking the menu items as active correctly' do
21
- context 'when URL is the root URL' do
22
- it_behaves_like 'marking current URLs as current and non-current ones not' do
20
+ shared_examples 'marking the navbar items as active correctly' do
21
+ context 'when the navbar item URL is the current root URL or root path' do
22
+ it_behaves_like 'marking current URLs as current and non-current URLs as not-current' do
23
23
  let(:navbar_item_urls) do
24
24
  %w(
25
25
  http://www.foobar.com/
@@ -31,20 +31,18 @@ shared_examples 'marking the menu items as active correctly' do
31
31
  %w(
32
32
  http://www.foobar.com/
33
33
  http://www.foobar.com
34
- /
35
34
  )
36
35
  end
37
36
  let(:non_current_urls) do
38
37
  %w(
39
38
  http://www.foobar.com/foo
40
- /foo
41
39
  )
42
40
  end
43
41
  end
44
42
  end
45
43
 
46
- context 'when URL is a sub URL' do
47
- it_behaves_like 'marking current URLs as current and non-current ones not' do
44
+ context 'when the navbar item URL is a sub URL of the current URL' do
45
+ it_behaves_like 'marking current URLs as current and non-current URLs as not-current' do
48
46
  let(:navbar_item_urls) do
49
47
  %w(
50
48
  http://www.foobar.com/foo/
@@ -57,39 +55,53 @@ shared_examples 'marking the menu items as active correctly' do
57
55
  %w(
58
56
  http://www.foobar.com/foo/
59
57
  http://www.foobar.com/foo
60
- /foo
61
- /foo/
62
-
63
58
  http://www.foobar.com/foo/bar/
64
59
  http://www.foobar.com/foo/bar
65
- /foo/bar
66
- /foo/bar/
67
60
  )
68
61
  end
69
62
  let(:non_current_urls) do
70
63
  %w(
71
64
  http://www.foobar.com/
72
65
  http://www.foobar.com
73
- /
74
-
75
66
  http://www.foobar.com/bar/
76
67
  http://www.foobar.com/bar
77
- /bar
78
- /bar/
68
+ )
69
+ end
70
+ end
71
+ end
72
+
73
+ context 'when the navbar item URL is an external URL' do
74
+ it_behaves_like 'marking current URLs as current and non-current URLs as not-current' do
75
+ let(:navbar_item_urls) do
76
+ %w(
77
+ http://www.barfoo.com/
78
+ http://www.barfoo.com
79
+ )
80
+ end
81
+ let(:current_urls) { [] }
82
+ let(:non_current_urls) do
83
+ %w(
84
+ http://www.foobar.com/
85
+ http://www.foobar.com
86
+ http://www.foobar.com/foo/
87
+ http://www.foobar.com/foo
79
88
  )
80
89
  end
81
90
  end
82
91
  end
83
92
  end
84
93
 
85
- shared_examples 'marking current URLs as current and non-current ones not' do
94
+ shared_examples 'marking current URLs as current and non-current URLs as not-current' do
86
95
  it 'generates the correct HTML' do
87
96
  navbar_item_urls.each do |navbar_item_url|
97
+ puts "Testing navbar item with URL #{navbar_item_url}..."
88
98
  current_urls.each do |current_url|
99
+ puts "...should be marked as active when current URL is #{current_url}"
89
100
  BootstrapNavbar.configuration.current_url_method = "'#{current_url}'"
90
101
  expect(renderer.navbar_item('foo', navbar_item_url)).to have_tag(:li, with: { class: 'active' })
91
102
  end
92
103
  non_current_urls.each do |non_current_url|
104
+ puts "...should not be marked as active when current URL is #{non_current_url}"
93
105
  BootstrapNavbar.configuration.current_url_method = "'#{non_current_url}'"
94
106
  expect(renderer.navbar_item('foo', navbar_item_url)).to have_tag(:li, without: { class: 'active' })
95
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-navbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Meurer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-14 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  version: '0'
153
153
  requirements: []
154
154
  rubyforge_project:
155
- rubygems_version: 2.2.0
155
+ rubygems_version: 2.2.2
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Helpers to generate a Twitter Bootstrap style navbar