breadcrumbs_on_rails 2.3.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,16 +3,14 @@
3
3
  #
4
4
  # A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
  module BreadcrumbsOnRails
10
10
 
11
11
  class Railtie < Rails::Railtie
12
- initializer "breadcrumbs_on_rails.initialize" do
13
- ActiveSupport.on_load(:action_controller) do
14
- include BreadcrumbsOnRails::ActionController
15
- end
12
+ ActiveSupport.on_load(:action_controller) do
13
+ ::ActionController::Base.send(:include, BreadcrumbsOnRails::ActionController)
16
14
  end
17
15
  end
18
16
 
@@ -3,20 +3,9 @@
3
3
  #
4
4
  # A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
5
5
  #
6
- # Copyright (c) 2009-2012 Simone Carletti <weppos@weppos.net>
6
+ # Copyright (c) 2009-2020 Simone Carletti <weppos@weppos.net>
7
7
  #++
8
8
 
9
9
  module BreadcrumbsOnRails
10
-
11
- module Version
12
- MAJOR = 2
13
- MINOR = 3
14
- PATCH = 0
15
- BUILD = nil
16
-
17
- STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
18
- end
19
-
20
- VERSION = Version::STRING
21
-
10
+ VERSION = "4.1.0"
22
11
  end
data/test/dummy.rb CHANGED
@@ -8,7 +8,7 @@ require "rails/railtie"
8
8
  class Dummy
9
9
  Routes = ActionDispatch::Routing::RouteSet.new
10
10
  Routes.draw do
11
- match ':controller(/:action(/:id))'
11
+ match ':controller(/:action(/:id))', via: [:get]
12
12
  end
13
13
  end
14
14
 
@@ -39,3 +39,8 @@ class ActiveSupport::TestCase
39
39
  end
40
40
 
41
41
  end
42
+
43
+ # Trigger lazy loading and causes the load_hooks to be executed on
44
+ # ActionController::API. This is important because breacrumbs_on_rails includes
45
+ # BreadcrumbsOnRails::ActionController on any module that executes these hooks
46
+ ActionController::API rescue NameError
data/test/test_helper.rb CHANGED
@@ -1,6 +1,9 @@
1
- require 'test/unit'
2
- require 'mocha'
1
+ require 'minitest/autorun'
2
+ require 'mocha/minitest'
3
3
  require 'dummy'
4
4
 
5
- $:.unshift File.expand_path('../../lib', __FILE__)
5
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
6
6
  require 'breadcrumbs_on_rails'
7
+
8
+ Encoding.default_external = Encoding::UTF_8
9
+ Encoding.default_internal = Encoding::UTF_8
@@ -16,7 +16,7 @@ class ExampleController < ActionController::Base
16
16
  def action_compute_paths
17
17
  add_breadcrumb "String", "/"
18
18
  add_breadcrumb "Proc", proc { |c| "/?proc" }
19
- add_breadcrumb "Polymorfic", [:admin, :namespace]
19
+ add_breadcrumb "Polymorphic", [:admin, :namespace]
20
20
  execute("action_default")
21
21
  end
22
22
 
@@ -30,7 +30,7 @@ class ExampleController < ActionController::Base
30
30
  end
31
31
 
32
32
  def admin_namespace_path(*)
33
- "/?polymorfic"
33
+ "/?polymorphic"
34
34
  end
35
35
  helper_method :admin_namespace_path
36
36
 
@@ -47,8 +47,46 @@ class ExampleControllerTest < ActionController::TestCase
47
47
 
48
48
  def test_render_compute_paths
49
49
  get :action_compute_paths
50
- assert_dom_equal %(<a href="/">String</a> &raquo; <a href="/?proc">Proc</a> &raquo; <a href="/?polymorfic">Polymorfic</a>),
51
- @response.body
50
+ assert_dom_equal %(<a href="/">String</a> &raquo; <a href="/?proc">Proc</a> &raquo; <a href="/?polymorphic">Polymorphic</a>),
51
+ @response.body.to_s
52
+ end
53
+
54
+ end
55
+
56
+ class ClassLevelExampleController < ActionController::Base
57
+ include BreadcrumbsOnRails::ActionController
58
+
59
+ add_breadcrumb "String", "/"
60
+ add_breadcrumb "Proc", proc { |c| "/?proc" }
61
+ add_breadcrumb "Polymorphic", [:admin, :namespace]
62
+ add_breadcrumb "With options", "/", :options => { :title => "Awesome" }
63
+
64
+ def action_default
65
+ render 'example/default'
66
+ end
67
+
68
+ private
69
+
70
+ def admin_namespace_path(*)
71
+ "/?polymorphic"
72
+ end
73
+ helper_method :admin_namespace_path
74
+
75
+ end
76
+
77
+ class ClassLevelExampleControllerTest < ActionController::TestCase
78
+
79
+ def test_render_default
80
+ expected = [].tap { |links|
81
+ links << '<a href="/">String</a>'
82
+ links << '<a href="/?proc">Proc</a>'
83
+ links << '<a href="/?polymorphic">Polymorphic</a>'
84
+ links << '<a title="Awesome" href="/">With options</a>'
85
+ }
86
+
87
+ get :action_default
88
+ assert_dom_equal expected.join(" &raquo; "),
89
+ @response.body.to_s
52
90
  end
53
91
 
54
92
  end
@@ -58,10 +96,10 @@ class ExampleHelpersTest < ActionView::TestCase
58
96
  include ActionView::Helpers::TagHelper
59
97
  include ActionView::Helpers::UrlHelper
60
98
 
61
- attr_accessor :breadcrumbs
99
+ attr_accessor :breadcrumbs_on_rails
62
100
 
63
101
  setup do
64
- self.breadcrumbs = []
102
+ self.breadcrumbs_on_rails = []
65
103
  end
66
104
 
67
105
  def test_render_breadcrumbs
@@ -60,6 +60,29 @@ class SimpleBuilderTest < ActionView::TestCase
60
60
  simplebuilder(@template, elements).render)
61
61
  end
62
62
 
63
+ def test_render_with_embedded_html
64
+ elements = [BreadcrumbsOnRails::Breadcrumbs::Element.new("Element <b>One</b>", nil)]
65
+ assert_dom_equal("Element &lt;b&gt;One&lt;/b&gt;",
66
+ simplebuilder(@template, elements).render)
67
+ end
68
+
69
+ def test_render_with_embedded_html_and_tags
70
+ elements = [BreadcrumbsOnRails::Breadcrumbs::Element.new("Element <b>One</b>", nil)]
71
+ assert_dom_equal("<li>Element &lt;b&gt;One&lt;/b&gt;</li>",
72
+ simplebuilder(@template, elements, {tag: :li} ).render)
73
+ end
74
+
75
+ def test_render_with_safe_embedded_html
76
+ elements = [BreadcrumbsOnRails::Breadcrumbs::Element.new("Element <b>One</b>".html_safe, nil)]
77
+ assert_dom_equal("Element <b>One</b>",
78
+ simplebuilder(@template, elements).render)
79
+ end
80
+
81
+ def test_render_with_embedded_html_and_tags
82
+ elements = [BreadcrumbsOnRails::Breadcrumbs::Element.new("Element <b>One</b>".html_safe, nil)]
83
+ assert_dom_equal("<li>Element <b>One</b></li>",
84
+ simplebuilder(@template, elements, {tag: :li} ).render)
85
+ end
63
86
 
64
87
  protected
65
88
 
metadata CHANGED
@@ -1,104 +1,53 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breadcrumbs_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
5
- prerelease:
4
+ version: 4.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Simone Carletti
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-25 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rails
14
+ name: railties
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: '3.0'
22
- type: :development
19
+ version: '5.0'
20
+ type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: '3.0'
30
- - !ruby/object:Gem::Dependency
31
- name: appraisal
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: mocha
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 0.9.10
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 0.9.10
62
- - !ruby/object:Gem::Dependency
63
- name: yard
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
26
+ version: '5.0'
78
27
  description: BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and
79
28
  managing a breadcrumb navigation for a Rails project.
80
- email: weppos@weppos.net
29
+ email:
30
+ - weppos@weppos.net
81
31
  executables: []
82
32
  extensions: []
83
- extra_rdoc_files: []
33
+ extra_rdoc_files:
34
+ - LICENSE.txt
84
35
  files:
85
- - .gitignore
86
- - .rvmrc
87
- - .travis.yml
36
+ - ".github/FUNDING.yml"
37
+ - ".gitignore"
38
+ - ".travis.yml"
88
39
  - Appraisals
89
40
  - CHANGELOG.md
90
41
  - Gemfile
91
42
  - LICENSE.txt
92
43
  - README.md
93
44
  - Rakefile
45
+ - SECURITY.md
94
46
  - breadcrumbs_on_rails.gemspec
95
- - gemfiles/3.0.gemfile
96
- - gemfiles/3.0.gemfile.lock
97
- - gemfiles/3.1.gemfile
98
- - gemfiles/3.1.gemfile.lock
99
- - gemfiles/3.2.gemfile
100
- - gemfiles/3.2.gemfile.lock
101
- - init.rb
47
+ - gemfiles/5.0.gemfile
48
+ - gemfiles/5.1.gemfile
49
+ - gemfiles/5.2.gemfile
50
+ - gemfiles/6.0.gemfile
102
51
  - lib/breadcrumbs_on_rails.rb
103
52
  - lib/breadcrumbs_on_rails/action_controller.rb
104
53
  - lib/breadcrumbs_on_rails/breadcrumbs.rb
@@ -111,30 +60,29 @@ files:
111
60
  - test/unit/element_test.rb
112
61
  - test/unit/simple_builder_test.rb
113
62
  - test/views/example/default.html.erb
114
- homepage: http://www.simonecarletti.com/code/breadcrumbs_on_rails
115
- licenses: []
116
- post_install_message:
63
+ homepage: https://simonecarletti.com/code/breadcrumbs_on_rails
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
117
68
  rdoc_options: []
118
69
  require_paths:
119
70
  - lib
120
71
  required_ruby_version: !ruby/object:Gem::Requirement
121
- none: false
122
72
  requirements:
123
- - - ! '>='
73
+ - - ">="
124
74
  - !ruby/object:Gem::Version
125
- version: '0'
75
+ version: '2.4'
126
76
  required_rubygems_version: !ruby/object:Gem::Requirement
127
- none: false
128
77
  requirements:
129
- - - ! '>='
78
+ - - ">="
130
79
  - !ruby/object:Gem::Version
131
80
  version: '0'
132
81
  requirements: []
133
- rubyforge_project:
134
- rubygems_version: 1.8.24
135
- signing_key:
136
- specification_version: 3
137
- summary: A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
82
+ rubygems_version: 3.1.4
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation
138
86
  test_files:
139
87
  - test/dummy.rb
140
88
  - test/test_helper.rb
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use @breadcrumbs_on_rails --create
data/gemfiles/3.0.gemfile DELETED
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "activerecord", "~> 3.0"
6
-
7
- gemspec :path=>"../"
@@ -1,100 +0,0 @@
1
- PATH
2
- remote: /Users/weppos/Code/breadcrumbs_on_rails
3
- specs:
4
- breadcrumbs_on_rails (2.1.0)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- actionmailer (3.2.1)
10
- actionpack (= 3.2.1)
11
- mail (~> 2.4.0)
12
- actionpack (3.2.1)
13
- activemodel (= 3.2.1)
14
- activesupport (= 3.2.1)
15
- builder (~> 3.0.0)
16
- erubis (~> 2.7.0)
17
- journey (~> 1.0.1)
18
- rack (~> 1.4.0)
19
- rack-cache (~> 1.1)
20
- rack-test (~> 0.6.1)
21
- sprockets (~> 2.1.2)
22
- activemodel (3.2.1)
23
- activesupport (= 3.2.1)
24
- builder (~> 3.0.0)
25
- activerecord (3.2.1)
26
- activemodel (= 3.2.1)
27
- activesupport (= 3.2.1)
28
- arel (~> 3.0.0)
29
- tzinfo (~> 0.3.29)
30
- activeresource (3.2.1)
31
- activemodel (= 3.2.1)
32
- activesupport (= 3.2.1)
33
- activesupport (3.2.1)
34
- i18n (~> 0.6)
35
- multi_json (~> 1.0)
36
- appraisal (0.4.0)
37
- bundler
38
- rake
39
- arel (3.0.0)
40
- builder (3.0.0)
41
- erubis (2.7.0)
42
- hike (1.2.1)
43
- i18n (0.6.0)
44
- journey (1.0.1)
45
- json (1.6.5)
46
- mail (2.4.1)
47
- i18n (>= 0.4.0)
48
- mime-types (~> 1.16)
49
- treetop (~> 1.4.8)
50
- mime-types (1.17.2)
51
- mocha (0.9.12)
52
- multi_json (1.0.4)
53
- polyglot (0.3.3)
54
- rack (1.4.1)
55
- rack-cache (1.1)
56
- rack (>= 0.4)
57
- rack-ssl (1.3.2)
58
- rack
59
- rack-test (0.6.1)
60
- rack (>= 1.0)
61
- rails (3.2.1)
62
- actionmailer (= 3.2.1)
63
- actionpack (= 3.2.1)
64
- activerecord (= 3.2.1)
65
- activeresource (= 3.2.1)
66
- activesupport (= 3.2.1)
67
- bundler (~> 1.0)
68
- railties (= 3.2.1)
69
- railties (3.2.1)
70
- actionpack (= 3.2.1)
71
- activesupport (= 3.2.1)
72
- rack-ssl (~> 1.3.2)
73
- rake (>= 0.8.7)
74
- rdoc (~> 3.4)
75
- thor (~> 0.14.6)
76
- rake (0.9.2.2)
77
- rdoc (3.12)
78
- json (~> 1.4)
79
- sprockets (2.1.2)
80
- hike (~> 1.2)
81
- rack (~> 1.0)
82
- tilt (~> 1.1, != 1.3.0)
83
- thor (0.14.6)
84
- tilt (1.3.3)
85
- treetop (1.4.10)
86
- polyglot
87
- polyglot (>= 0.3.1)
88
- tzinfo (0.3.31)
89
- yard (0.7.5)
90
-
91
- PLATFORMS
92
- ruby
93
-
94
- DEPENDENCIES
95
- activerecord (~> 3.0)
96
- appraisal
97
- breadcrumbs_on_rails!
98
- mocha (~> 0.9.10)
99
- rails (>= 3.0)
100
- yard