simple-navigation 4.2.0 → 4.3.0

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
  SHA256:
3
- metadata.gz: 9df430bc691baeee7336fcfbbf5b6702b89440da2d61a2d7cf9e654e04241f09
4
- data.tar.gz: '059b49e4ac9536964aff8678c86dea636bdc29f3ceeeb51d661e4b0b3df02733'
3
+ metadata.gz: 32593dd3a7c2dd75f81fe21b56e89ec3fff2570b73461eac762b7911fc096297
4
+ data.tar.gz: afed0ee3fdf40f71edb92446191699482c52e8cea2bcaf5cf4a9430f55b4e0a2
5
5
  SHA512:
6
- metadata.gz: 6a5b51b3afcc9f5324335d7064bcc12cd417d151384b219ad1b2db10d3d161a9517cbcd9a9c766555c93e7b343d3ca233ab50663459670fc6b4804216fc57534
7
- data.tar.gz: 98417524e1562117207ca2f9c5eddc77328e8d0d5ef3da1ef42f52c420634c7e011931622d5f642d869d265f4b4ffda9c3477a31ea03b2cf3d200f7c2d7d1ca4
6
+ metadata.gz: b70cf93db548b4521e4ee41d8df47c782f7ea1b849935e157dc5d1f686eb32b285daa42bad75a643c208b739097083ce94d90554c7826288cc38724198cba6a0
7
+ data.tar.gz: 5a376e9eeca42af65b8e23b37b30b3947c3b1d2554e55a3e2527705a80a077fd655d4fddff29b9f744b461f4affdd17ee2640a27fda924e3872882106bcbab8c
data/.travis.yml CHANGED
@@ -3,6 +3,12 @@ before_install:
3
3
 
4
4
  matrix:
5
5
  include:
6
+ - rvm: 2.5.8
7
+ gemfile: gemfiles/rails-6-1-stable.gemfile
8
+ - rvm: 2.6.7
9
+ gemfile: gemfiles/rails-6-1-stable.gemfile
10
+ - rvm: 2.7.3
11
+ gemfile: gemfiles/rails-6-1-stable.gemfile
6
12
  - rvm: 2.5.3
7
13
  gemfile: gemfiles/rails-6-0-stable.gemfile
8
14
  - rvm: 2.6.0
@@ -15,4 +21,3 @@ matrix:
15
21
  gemfile: gemfiles/rails-4-1-stable.gemfile
16
22
  - rvm: 2.3.3
17
23
  gemfile: gemfiles/rails-3-2-stable.gemfile
18
-
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.3.0
4
+
5
+ * removed warnings from rspec. Thanks mgrunberg.
6
+ * add compatibility with rails 6.1. Credits to mgrunberg.
7
+ * run specs against 6.1. Credits to mgrunberg.
8
+
3
9
  ## 4.2.0
4
10
 
5
11
  * improvements to generator template. Credits to mgrunberg.
data/Rakefile CHANGED
@@ -17,6 +17,7 @@ namespace :spec do
17
17
  rails-4-2-stable
18
18
  rails-5-2-stable
19
19
  rails-6-0-stable
20
+ rails-6-1-stable
20
21
  ]
21
22
 
22
23
  mappers.each do |gemfile|
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake', '< 11.0'
4
+
5
+ # not yet
6
+ gem 'railties', '~> 6.1.0'
7
+ gem 'rspec-rails', '~> 3.8.2'
8
+
9
+ gemspec path: '../'
@@ -1,3 +1,3 @@
1
1
  module SimpleNavigation
2
- VERSION = '4.2.0'
2
+ VERSION = '4.3.0'
3
3
  end
@@ -186,7 +186,7 @@ module SimpleNavigation
186
186
  before { adapter.instance_variable_set(:@template, nil) }
187
187
 
188
188
  it 'raises an exception' do
189
- expect{ adapter.context_for_eval }.to raise_error
189
+ expect{ adapter.context_for_eval }.to raise_error(RuntimeError, 'no context set for evaluation the config file')
190
190
  end
191
191
  end
192
192
  end
@@ -9,7 +9,7 @@ describe SimpleNavigation::Adapters::Sinatra do
9
9
  context "when adapter's context is not set" do
10
10
  it 'raises an exception' do
11
11
  allow(adapter).to receive_messages(context: nil)
12
- expect{ adapter.context_for_eval }.to raise_error
12
+ expect{ adapter.context_for_eval }.to raise_error(RuntimeError, 'no context set for evaluation the config file')
13
13
  end
14
14
  end
15
15
 
@@ -23,7 +23,7 @@ module SimpleNavigation
23
23
 
24
24
  context 'and no navigation.rb file is found in the paths' do
25
25
  it 'raises an exception' do
26
- expect{ finder.find(context) }.to raise_error
26
+ expect { finder.find(context) }.to raise_error(RuntimeError, /Config file 'navigation.rb' not found in path\(s\)/)
27
27
  end
28
28
  end
29
29
  end
@@ -41,7 +41,7 @@ module SimpleNavigation
41
41
 
42
42
  context 'and no other_navigation.rb file is found in the paths' do
43
43
  it 'raise an exception' do
44
- expect{ finder.find(context) }.to raise_error
44
+ expect{ finder.find(context) }.to raise_error(RuntimeError, /Config file 'other_navigation.rb' not found in path\(s\)/)
45
45
  end
46
46
  end
47
47
  end
@@ -89,7 +89,7 @@ module SimpleNavigation
89
89
  let(:provider) { double(:provider) }
90
90
 
91
91
  it 'raises an exception' do
92
- expect{ config.items(provider) {} }.to raise_error
92
+ expect{ config.items(provider) {} }.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both')
93
93
  end
94
94
  end
95
95
 
@@ -139,7 +139,7 @@ module SimpleNavigation
139
139
 
140
140
  context 'when items_provider is not specified' do
141
141
  it "raises an exception" do
142
- expect{ config.items }.to raise_error
142
+ expect{ config.items }.to raise_error(RuntimeError, 'please specify either items_provider or block, but not both')
143
143
  end
144
144
  end
145
145
  end
@@ -382,7 +382,7 @@ module SimpleNavigation
382
382
  it 'raises an exception' do
383
383
  expect{
384
384
  controller.render_navigation(level: :invalid)
385
- }.to raise_error
385
+ }.to raise_error(ArgumentError, 'Invalid navigation level: invalid')
386
386
  end
387
387
  end
388
388
  end
@@ -408,7 +408,7 @@ module SimpleNavigation
408
408
  before { allow(SimpleNavigation).to receive_messages(primary_navigation: nil) }
409
409
 
410
410
  it 'raises an exception' do
411
- expect{controller.render_navigation}.to raise_error
411
+ expect{controller.render_navigation}.to raise_error(RuntimeError, 'no primary navigation defined, either use a navigation config file or pass items directly to render_navigation')
412
412
  end
413
413
  end
414
414
 
@@ -435,7 +435,7 @@ module SimpleNavigation
435
435
  it 'raises an error' do
436
436
  expect{
437
437
  item_container.item('key', 'name', 'url', { if: 'text' })
438
- }.to raise_error
438
+ }.to raise_error(ArgumentError, ':if or :unless must be procs or lambdas')
439
439
  end
440
440
  end
441
441
  end
@@ -346,7 +346,7 @@ module SimpleNavigation
346
346
  let(:options) {{ highlights_on: :hello }}
347
347
 
348
348
  it 'raises an exception' do
349
- expect{ item.selected? }.to raise_error
349
+ expect{ item.selected? }.to raise_error(ArgumentError, ':highlights_on must be a Regexp, Proc or :subpath')
350
350
  end
351
351
  end
352
352
  end
@@ -36,7 +36,7 @@ module SimpleNavigation
36
36
  let(:provider) { double(:provider) }
37
37
 
38
38
  it 'raises an exception' do
39
- expect{ items_provider.items }.to raise_error
39
+ expect{ items_provider.items }.to raise_error(RuntimeError, /items_provider either must be a symbol .*, an object .* or an enumerable/)
40
40
  end
41
41
  end
42
42
  end
@@ -32,7 +32,7 @@ module SimpleNavigation
32
32
 
33
33
  describe '#render' do
34
34
  it "raise an exception to indicate it's a subclass responsibility" do
35
- expect{ base.render(:container) }.to raise_error
35
+ expect{ base.render(:container) }.to raise_error(NotImplementedError, 'subclass responsibility')
36
36
  end
37
37
  end
38
38
 
@@ -104,7 +104,7 @@ describe SimpleNavigation do
104
104
 
105
105
  context "when the config file for the context doesn't exists" do
106
106
  it 'raises an exception' do
107
- expect{ subject.load_config }.to raise_error
107
+ expect{ subject.load_config }.to raise_error(RuntimeError, /Config file 'navigation.rb' not found in path\(s\)/)
108
108
  end
109
109
  end
110
110
  end
@@ -152,7 +152,7 @@ describe SimpleNavigation do
152
152
  it 'raises an exception' do
153
153
  expect{
154
154
  subject.active_item_container_for('something else')
155
- }.to raise_error
155
+ }.to raise_error(ArgumentError, 'Invalid navigation level: something else')
156
156
  end
157
157
  end
158
158
  end
data/spec/spec_helper.rb CHANGED
@@ -24,7 +24,10 @@ end
24
24
 
25
25
  def setup_adapter_for(framework, context = double(:context))
26
26
  if framework == :rails
27
- allow(context).to receive_messages(view_context: ActionView::Base.new)
27
+ # Rails 6.0 and 6.1 provide ActionView::Base.empty method that creates ActionView with an empty LookupContext.
28
+ # The method is not available on older versions
29
+ view_context = ActionView::Base.respond_to?(:empty) ? ActionView::Base.empty : ActionView::Base.new
30
+ allow(context).to receive_messages(view_context: view_context)
28
31
  end
29
32
 
30
33
  allow(SimpleNavigation).to receive_messages(framework: framework)
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.2.0
4
+ version: 4.3.0
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: 2021-05-11 00:00:00.000000000 Z
13
+ date: 2021-05-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -177,6 +177,7 @@ files:
177
177
  - gemfiles/rails-4-2-stable.gemfile
178
178
  - gemfiles/rails-5-2-stable.gemfile
179
179
  - gemfiles/rails-6-0-stable.gemfile
180
+ - gemfiles/rails-6-1-stable.gemfile
180
181
  - generators/navigation_config/USAGE
181
182
  - generators/navigation_config/navigation_config_generator.rb
182
183
  - generators/navigation_config/templates/config/navigation.rb