simple-navigation 4.0.1 → 4.0.2

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: 864fb7d23c859c2b6860665959c0c86552b861c9
4
- data.tar.gz: 442fc31944b9071bf9c2a9e79540a5ecb32afb57
3
+ metadata.gz: 74cc5517ce88a27754c28387348f7e6123b47635
4
+ data.tar.gz: cdc2d6be45b5db54783bc6c0648a83e08269a51e
5
5
  SHA512:
6
- metadata.gz: f7aed4c1680ded95184317b4c3a9c29d0000fca215a1ec69aa11db4b3bb81a3a9c64e16b0d2f5a6150ed78f696474737c2c80ced0f28e548cb0be2088a2c41f2
7
- data.tar.gz: e0a44ac37c1c98682378a9116b47dcca2300a6e3f0fb302741af81d12daf123802232686c6da8d7bfde825037e0d8673899d907ec974a6873ae12856f2ca08a7
6
+ metadata.gz: bb71f7c8d13ca7b614018a7b3adb20c36d80e17c321808440dbc36cd828ee142b55014bf9edaab58deecdfc1f80705b7104bb51099165ed66ecc26a63e7f30c6
7
+ data.tar.gz: 10105e6488f0563814605edb78f4a6db4f16beef9074d898684df514b46c26bb210ebc529ea2b8b837ab7c7fe99bd94b6960d4e09e292f7ba861bdbd6dc94bdb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.2
4
+
5
+ * fixing current_page? when url is nil
6
+
3
7
  ## 4.0.1
4
8
 
5
9
  * fixed padrino adapter
@@ -38,7 +38,7 @@ module SimpleNavigation
38
38
  end
39
39
 
40
40
  def current_page?(url)
41
- template && template.current_page?(url)
41
+ url && template && template.current_page?(url)
42
42
  end
43
43
 
44
44
  def link_to(name, url, options = {})
@@ -140,11 +140,11 @@ module SimpleNavigation
140
140
  def remove_anchors(url_with_anchors)
141
141
  url_with_anchors && url_with_anchors.split('#').first
142
142
  end
143
-
143
+
144
144
  def remove_query_params(url_with_params)
145
145
  url_with_params && url_with_params.split('?').first
146
146
  end
147
-
147
+
148
148
  def url_for_autohighlight
149
149
  relevant_url = remove_anchors(self.url) if config.ignore_anchors_on_auto_highlight
150
150
  relevant_url = remove_query_params(relevant_url) if config.ignore_query_params_on_auto_highlight
@@ -1,3 +1,3 @@
1
1
  module SimpleNavigation
2
- VERSION = '4.0.1'
2
+ VERSION = '4.0.2'
3
3
  end
@@ -206,7 +206,13 @@ module SimpleNavigation
206
206
  before { allow(adapter).to receive_messages(template: nil) }
207
207
 
208
208
  it 'returns false' do
209
- expect(adapter).not_to be_current_page(:page)
209
+ expect(adapter.current_page?(:page)).to be_falsey
210
+ end
211
+ end
212
+
213
+ context 'when the given url is nil' do
214
+ it 'returns false' do
215
+ expect(adapter.current_page?(nil)).to be_falsey
210
216
  end
211
217
  end
212
218
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andi Schacke
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-04-02 00:00:00.000000000 Z
13
+ date: 2015-04-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport