breadcrumbs 0.2.0 โ†’ 0.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: 638b77085849ea1f06cb4c55b11f3baecaaeae84b5fce2c98e8421ac18e20929
4
- data.tar.gz: 3bd0227aa31d6630f29b6d2c7e37a1ba3a76df992cfe716bb1bc343473abff19
3
+ metadata.gz: 9469ca3bb1e994e5914e7d20dd3befc975347e06d0f139f231ecc566a90f5a89
4
+ data.tar.gz: f41ffaded5c611b2a9fc30d909d599d312bf50a6750aa0a75fdabc1c2d8b1bef
5
5
  SHA512:
6
- metadata.gz: 676edfeedcdd4a914bfbb2ad3caa6a29e6be4ab9f50f4106f715510a52a669eca7504c1ee99854f712cb929a0723436d7cfd63fccd8e471050249c4c40ef9e1e
7
- data.tar.gz: 4a015506ccc94efa8cd8b228ac38dda10409e88e60191036a4e3fc5a6fc1f909e36292b9fe3dace9cf5541bc4886f0e5491e250f7a1386aaab66c620e2802bb7
6
+ metadata.gz: d35875762fca9091a8d2c2866202d3e381c9d466a467af04ad5e5c32b900476c4c15d472e531f288817810de136cbb8b0d9237edeefedb574ed294f2f8d7ae5a
7
+ data.tar.gz: 7db21eaa5f88683fe4f4dd3d12703d81e93d436d7b3fcafa4afaa6ea177d9ddea0433e10d24db3cd7075b576bc939203e47e31043b394511286db3442ea34c57
@@ -0,0 +1,4 @@
1
+ # You can read more about CODEOWNERS at
2
+ # https://help.github.com/github/creating-cloning-and-archiving-repositories/about-code-owners
3
+
4
+ * @fnando
data/.github/FUNDING.yml CHANGED
@@ -1,3 +1,4 @@
1
+ # These are supported funding model platforms
1
2
  ---
2
3
  github: [fnando]
3
- custom: ["https://www.paypal.me/nandovieira/๐Ÿ•"]
4
+ custom: ["https://paypal.me/nandovieira/๐Ÿ•"]
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: "๐Ÿ› Bug Report"
3
+ about: Report a reproducible bug or regression.
4
+ title: "Bug: "
5
+ labels: "Status: Unconfirmed"
6
+ ---
7
+
8
+ <!--
9
+ - Please provide a clear and concise description of what the bug is.
10
+ - If possible, add an example reproducing your issue.
11
+ - Please test using the latest version of breadcrumbs
12
+ to make sure your issue has not already been fixed.
13
+ -->
14
+
15
+ ## Description
16
+
17
+ [Add bug description here]
18
+
19
+ ## How to reproduce
20
+
21
+ [Add steps on how to reproduce this issue]
22
+
23
+ ## What do you expect
24
+
25
+ [Describe what do you expect to happen]
26
+
27
+ ## What happened instead
28
+
29
+ [Describe the actual results]
30
+
31
+ ## Software:
32
+
33
+ - Gem version: [Add gem version here]
34
+ - Ruby version: [Add version here]
35
+
36
+ ## Full backtrace
37
+
38
+ ```text
39
+ [Paste full backtrace here]
40
+ ```
@@ -0,0 +1,5 @@
1
+ ---
2
+ contact_links:
3
+ - name: "๐Ÿคจ Q&A"
4
+ url: https://github.com/fnando/breadcrumbs/discussions/new?category=q-a
5
+ about: Have a question? Ask it away here!
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: "๐Ÿ’ก Feature request"
3
+ about: Have an idea that may be useful? Make a suggestion!
4
+ title: 'Feature Request: '
5
+ labels: 'Feature request'
6
+
7
+ ---
8
+
9
+ ## Description
10
+
11
+ _A clear and concise description of what the problem is._
12
+
13
+ ## Describe the solution
14
+
15
+ _A clear and concise description of what you want to happen._
16
+
17
+ ## Alternatives you considered
18
+
19
+ _A clear and concise description of any alternative solutions or features you've considered._
20
+
21
+ ## Additional context
22
+
23
+ _Add any other context, screenshots, links, etc about the feature request here._
@@ -0,0 +1,38 @@
1
+ <!--
2
+ If you're making a doc PR or something tiny where the below is irrelevant,
3
+ delete this template and use a short description, but in your description aim to
4
+ include both what the change is, and why it is being made, with enough context
5
+ for anyone to understand.
6
+ -->
7
+
8
+ <details>
9
+ <summary>PR Checklist</summary>
10
+
11
+ ### PR Structure
12
+
13
+ - [ ] This PR has reasonably narrow scope (if not, break it down into smaller
14
+ PRs).
15
+ - [ ] This PR avoids mixing refactoring changes with feature changes (split into
16
+ two PRs otherwise).
17
+ - [ ] This PR's title starts is concise and descriptive.
18
+
19
+ ### Thoroughness
20
+
21
+ - [ ] This PR adds tests for the most critical parts of the new functionality or
22
+ fixes.
23
+ - [ ] I've updated any docs, `.md` files, etcโ€ฆ affected by this change.
24
+
25
+ </details>
26
+
27
+ ### What
28
+
29
+ [TODO: Short statement about what is changing.]
30
+
31
+ ### Why
32
+
33
+ [TODO: Why this change is being made. Include any context required to understand
34
+ the why.]
35
+
36
+ ### Known limitations
37
+
38
+ [TODO or N/A]
@@ -0,0 +1,20 @@
1
+ ---
2
+ # Documentation:
3
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
4
+
5
+ version: 2
6
+ updates:
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
11
+
12
+ - package-ecosystem: npm
13
+ directory: "/"
14
+ schedule:
15
+ interval: "daily"
16
+
17
+ - package-ecosystem: bundler
18
+ directory: "/"
19
+ schedule:
20
+ interval: "daily"
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: ruby-tests
3
+
4
+ on:
5
+ pull_request_target:
6
+ push:
7
+ branches:
8
+ - main
9
+ workflow_dispatch:
10
+ inputs: {}
11
+
12
+ jobs:
13
+ build:
14
+ name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
15
+ runs-on: "ubuntu-latest"
16
+ if: |
17
+ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
18
+ github.actor != 'dependabot[bot]'
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ ruby: ["2.7", "3.0", "3.1"]
23
+ gemfile:
24
+ - Gemfile
25
+
26
+ steps:
27
+ - uses: actions/checkout@v2.4.0
28
+
29
+ - uses: actions/cache@v2
30
+ with:
31
+ path: vendor/bundle
32
+ key: >
33
+ ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
34
+
35
+ - name: Set up Ruby
36
+ uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby }}
39
+
40
+ - name: Install gem dependencies
41
+ env:
42
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
43
+ run: |
44
+ gem install bundler
45
+ bundle config path vendor/bundle
46
+ bundle update --jobs 4 --retry 3
47
+
48
+ - name: Run Tests
49
+ env:
50
+ BUNDLE_GEMFILE: ${{ matrix.gemfile }}
51
+ run: |
52
+ bundle exec rake
data/.rubocop.yml CHANGED
@@ -8,15 +8,4 @@ AllCops:
8
8
  Exclude:
9
9
  - examples/**/*
10
10
  - vendor/**/*
11
-
12
- Metrics/MethodLength:
13
- Enabled: false
14
-
15
- Metrics/AbcSize:
16
- Enabled: false
17
-
18
- Metrics/MethodLength:
19
- Enabled: false
20
-
21
- Metrics/ClassLength:
22
- Enabled: false
11
+ - gemfiles/**/*
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at me@fnando.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,80 @@
1
+ # Contributing to breadcrumbs
2
+
3
+ ๐Ÿ‘๐ŸŽ‰ First off, thanks for taking the time to contribute! ๐ŸŽ‰๐Ÿ‘
4
+
5
+ The following is a set of guidelines for contributing to this project. These are
6
+ mostly guidelines, not rules. Use your best judgment, and feel free to propose
7
+ changes to this document in a pull request.
8
+
9
+ ## Code of Conduct
10
+
11
+ Everyone interacting in this project's codebases, issue trackers, chat rooms and
12
+ mailing lists is expected to follow the
13
+ [code of conduct](https://github.com/fnando/breadcrumbs/blob/main/CODE_OF_CONDUCT.md).
14
+
15
+ ## Reporting bugs
16
+
17
+ This section guides you through submitting a bug report. Following these
18
+ guidelines helps maintainers and the community understand your report, reproduce
19
+ the behavior, and find related reports.
20
+
21
+ - Before creating bug reports, please check the open issues; somebody may
22
+ already have submitted something similar, and you may not need to create a new
23
+ one.
24
+ - When you are creating a bug report, please include as many details as
25
+ possible, with an example reproducing the issue.
26
+
27
+ ## Contributing with code
28
+
29
+ Before making any radicals changes, please make sure you discuss your intention
30
+ by [opening an issue on Github](https://github.com/fnando/breadcrumbs/issues).
31
+
32
+ When you're ready to make your pull request, follow checklist below to make sure
33
+ your contribution is according to how this project works.
34
+
35
+ 1. [Fork](https://help.github.com/forking/) breadcrumbs
36
+ 2. Create a topic branch - `git checkout -b my_branch`
37
+ 3. Make your changes using [descriptive commit messages](#commit-messages)
38
+ 4. Update CHANGELOG.md describing your changes by adding an entry to the
39
+ "Unreleased" section. If this section is not available, create one right
40
+ before the last version.
41
+ 5. Push to your branch - `git push origin my_branch`
42
+ 6. [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
43
+ 7. That's it!
44
+
45
+ ## Styleguides
46
+
47
+ ### Commit messages
48
+
49
+ - Use the present tense ("Add feature" not "Added feature")
50
+ - Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
51
+ - Limit the first line to 72 characters or less
52
+ - Reference issues and pull requests liberally after the first line
53
+
54
+ ### Changelog
55
+
56
+ - Add a message describing your changes to the "Unreleased" section. The
57
+ changelog message should follow the same style as the commit message.
58
+ - Prefix your message with one of the following:
59
+ - `[Added]` for new features.
60
+ - `[Changed]` for changes in existing functionality.
61
+ - `[Deprecated]` for soon-to-be removed features.
62
+ - `[Removed]` for now removed features.
63
+ - `[Fixed]` for any bug fixes.
64
+ - `[Security]` in case of vulnerabilities.
65
+
66
+ ### Ruby code
67
+
68
+ - This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
69
+ submitting your changes, make sure your tests are passing and code conforms to
70
+ the expected style by running `rake`.
71
+ - Do not change the library version. This will be done by the maintainer
72
+ whenever a new version is about to be released.
73
+
74
+ ### JavaScript code
75
+
76
+ - This project uses [ESLint](https://eslint.org) to enforce code style. Before
77
+ submitting your changes, make sure your tests are passing and code conforms to
78
+ the expected style by running `yarn test:ci`.
79
+ - Do not change the library version. This will be done by the maintainer
80
+ whenever a new version is about to be released.
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Nando Vieira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Breadcrumbs
2
2
 
3
- [![Travis-CI](https://travis-ci.org/fnando/breadcrumbs.svg)](https://travis-ci.org/fnando/breadcrumbs)
4
- [![Code Climate](https://codeclimate.com/github/fnando/breadcrumbs/badges/gpa.svg)](https://codeclimate.com/github/fnando/breadcrumbs)
3
+ [![ruby-tests](https://github.com/fnando/breadcrumbs/actions/workflows/ruby-tests.yml/badge.svg)](https://github.com/fnando/breadcrumbs/actions/workflows/ruby-tests.yml)
5
4
  [![Gem](https://img.shields.io/gem/v/breadcrumbs.svg)](https://rubygems.org/gems/breadcrumbs)
6
5
  [![Gem](https://img.shields.io/gem/dt/breadcrumbs.svg)](https://rubygems.org/gems/breadcrumbs)
7
6
 
@@ -119,25 +118,25 @@ breadcrumbs.add :home, nil, i18n: false
119
118
 
120
119
  ## Maintainer
121
120
 
122
- - Nando Vieira - http://nandovieira.com
121
+ - [Nando Vieira](https://github.com/fnando)
123
122
 
124
- ## License
123
+ ## Contributors
124
+
125
+ - https://github.com/fnando/breadcrumbs/contributors
126
+
127
+ ## Contributing
125
128
 
126
- (The MIT License)
129
+ For more details about how to contribute, please read
130
+ https://github.com/fnando/breadcrumbs/blob/main/CONTRIBUTING.md.
131
+
132
+ ## License
127
133
 
128
- Permission is hereby granted, free of charge, to any person obtaining a copy of
129
- this software and associated documentation files (the 'Software'), to deal in
130
- the Software without restriction, including without limitation the rights to
131
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
132
- the Software, and to permit persons to whom the Software is furnished to do so,
133
- subject to the following conditions:
134
+ The gem is available as open source under the terms of the
135
+ [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
136
+ found at https://github.com/fnando/breadcrumbs/blob/main/LICENSE.md.
134
137
 
135
- The above copyright notice and this permission notice shall be included in all
136
- copies or substantial portions of the Software.
138
+ ## Code of Conduct
137
139
 
138
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
139
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
140
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
141
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
142
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
143
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140
+ Everyone interacting in the breadcrumbs project's codebases, issue trackers,
141
+ chat rooms and mailing lists is expected to follow the
142
+ [code of conduct](https://github.com/fnando/breadcrumbs/blob/main/CODE_OF_CONDUCT.md).
data/breadcrumbs.gemspec CHANGED
@@ -12,7 +12,18 @@ Gem::Specification.new do |s|
12
12
  s.summary = "Breadcrumbs is a simple plugin that adds a `breadcrumbs` " \
13
13
  "object to controllers and views."
14
14
  s.description = s.summary
15
- s.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
15
+ s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
+
17
+ github_url = "https://github.com/fnando/breadcrumbs"
18
+ github_tree_url = "#{github_url}/tree/v#{s.version}"
19
+
20
+ s.metadata["homepage_uri"] = s.homepage
21
+ s.metadata["bug_tracker_uri"] = "#{github_url}/issues"
22
+ s.metadata["source_code_uri"] = github_tree_url
23
+ s.metadata["changelog_uri"] = "#{github_tree_url}/CHANGELOG.md"
24
+ s.metadata["documentation_uri"] = "#{github_tree_url}/README.md"
25
+ s.metadata["license_uri"] = "#{github_tree_url}/LICENSE.md"
26
+ s.metadata["rubygems_mfa_required"] = "true"
16
27
 
17
28
  s.files = `git ls-files`.split("\n")
18
29
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -3,7 +3,7 @@
3
3
  class Breadcrumbs
4
4
  module Version # :nodoc: all
5
5
  MAJOR = 0
6
- MINOR = 2
6
+ MINOR = 3
7
7
  PATCH = 0
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
data/lib/breadcrumbs.rb CHANGED
@@ -65,6 +65,8 @@ class Breadcrumbs
65
65
  end
66
66
 
67
67
  def translate(scope) # :nodoc:
68
+ return scope if scope.match?(/\A[\s.]+\z/)
69
+
68
70
  text = begin
69
71
  I18n.t(scope, scope: "breadcrumbs", raise: true)
70
72
  rescue StandardError
@@ -8,11 +8,11 @@ class BreadcrumbsTest < Minitest::Test
8
8
  @inline = Breadcrumbs::Render::Inline.new(@breadcrumbs)
9
9
  end
10
10
 
11
- def test_return_safe_html
11
+ test "returns safe html" do
12
12
  assert @breadcrumbs.render(format: "list").html_safe?
13
13
  end
14
14
 
15
- def test_add_item
15
+ test "adds item" do
16
16
  @breadcrumbs.add "Home"
17
17
  assert_equal 1, @breadcrumbs.items.count
18
18
 
@@ -20,23 +20,23 @@ class BreadcrumbsTest < Minitest::Test
20
20
  assert_equal 2, @breadcrumbs.items.count
21
21
  end
22
22
 
23
- def test_tag_with_attributes
23
+ test "renders tag with attributes" do
24
24
  expected = %[<span class="greetings" id="hi">Hi!</span>]
25
25
  assert_equal expected,
26
26
  @inline.tag(:span, "Hi!", class: "greetings", id: "hi")
27
27
  end
28
28
 
29
- def test_tag_with_block
29
+ test "renders tag with block" do
30
30
  assert_equal "<span>Hi!</span>", @inline.tag(:span) { "Hi!" }
31
31
  end
32
32
 
33
- def test_tag_with_block_and_attributes
33
+ test "renders tag with block and attributes" do
34
34
  expected = %[<span class="greetings" id="hi">Hi!</span>]
35
35
  assert_equal expected,
36
36
  @inline.tag(:span, class: "greetings", id: "hi") { "Hi!" }
37
37
  end
38
38
 
39
- def test_nested_tags
39
+ test "renders nested tags" do
40
40
  expected = %[<span class="greetings"><strong id="hi">Hi!</strong></span>]
41
41
  actual = @inline.tag(:span, class: "greetings") do
42
42
  @inline.tag(:strong, "Hi!", id: "hi")
@@ -45,7 +45,7 @@ class BreadcrumbsTest < Minitest::Test
45
45
  assert_equal expected, actual
46
46
  end
47
47
 
48
- def test_render_as_list
48
+ test "renders as list" do
49
49
  @breadcrumbs.add "Home", "/", class: "home"
50
50
  html = Nokogiri::HTML(@breadcrumbs.render)
51
51
 
@@ -53,21 +53,21 @@ class BreadcrumbsTest < Minitest::Test
53
53
  assert_nil html.at("ul.breadcrumbs[format=list]")
54
54
  end
55
55
 
56
- def test_render_as_ordered_list
56
+ test "renders as ordered list" do
57
57
  @breadcrumbs.add "Home", "/"
58
58
  html = Nokogiri::HTML(@breadcrumbs.render(format: "ordered_list"))
59
59
 
60
60
  refute_nil html.at("ol.breadcrumbs")
61
61
  end
62
62
 
63
- def test_render_as_list_with_custom_attributes
63
+ test "renders as list with custom attributes" do
64
64
  @breadcrumbs.add "Home", "/", class: "home"
65
65
  html = Nokogiri::HTML(@breadcrumbs.render(id: "breadcrumbs", class: "top"))
66
66
 
67
67
  refute_nil html.at("ul.top#breadcrumbs")
68
68
  end
69
69
 
70
- def test_render_as_list_add_items
70
+ test "renders as list add items" do
71
71
  @breadcrumbs.add "Home", "/", class: "home"
72
72
  @breadcrumbs.add "About", "/about", class: "about"
73
73
  @breadcrumbs.add "People"
@@ -97,14 +97,14 @@ class BreadcrumbsTest < Minitest::Test
97
97
  refute_nil items[2].at("span")
98
98
  end
99
99
 
100
- def test_render_inline
100
+ test "renders inline" do
101
101
  @breadcrumbs.add "Home", "/", class: "home"
102
102
  html = Nokogiri::HTML(@breadcrumbs.render(format: "inline"))
103
103
 
104
104
  assert_nil html.at("ul.breadcrumbs")
105
105
  end
106
106
 
107
- def test_render_inline_add_items
107
+ test "renders inline add items" do
108
108
  @breadcrumbs.add "Home", "/", class: "home"
109
109
  @breadcrumbs.add "About", "/about", class: "about"
110
110
  @breadcrumbs.add "People"
@@ -140,7 +140,7 @@ class BreadcrumbsTest < Minitest::Test
140
140
  assert_equal "People", items[4].inner_text
141
141
  end
142
142
 
143
- def test_render_inline_with_custom_separator
143
+ test "renders inline with custom separator" do
144
144
  @breadcrumbs.add "Home", "/", class: "home"
145
145
  @breadcrumbs.add "People"
146
146
 
@@ -149,7 +149,7 @@ class BreadcrumbsTest < Minitest::Test
149
149
  assert_equal "|", html.at("span.separator").inner_text
150
150
  end
151
151
 
152
- def test_render_original_text_when_disabling_translation
152
+ test "renders original text when disabling_translation" do
153
153
  @breadcrumbs.add :home, nil, i18n: false
154
154
  @breadcrumbs.add :people
155
155
 
@@ -161,7 +161,7 @@ class BreadcrumbsTest < Minitest::Test
161
161
  assert_equal "Nosso time", items[1].inner_text
162
162
  end
163
163
 
164
- def test_render_internationalized_text_using_default_scope
164
+ test "renders internationalized text using default scope" do
165
165
  @breadcrumbs.add :home
166
166
  @breadcrumbs.add :people
167
167
 
@@ -173,7 +173,7 @@ class BreadcrumbsTest < Minitest::Test
173
173
  assert_equal "Nosso time", items[1].inner_text
174
174
  end
175
175
 
176
- def test_render_scope_as_text_for_missing_scope
176
+ test "renders scope as text for missing scope" do
177
177
  @breadcrumbs.add :contact
178
178
  @breadcrumbs.add "Help"
179
179
 
@@ -184,22 +184,37 @@ class BreadcrumbsTest < Minitest::Test
184
184
  assert_equal "Help", items[1].inner_text
185
185
  end
186
186
 
187
- def test_pimp_action_controller
187
+ test "extends action controller" do
188
188
  methods = ActionController::Base.instance_methods
189
189
  assert(methods.include?(:breadcrumbs) || methods.include?("breadcrumbs"))
190
190
  end
191
191
 
192
- def test_escape_text_when_rendering_inline
192
+ test "escapes text when rendering inline" do
193
193
  @breadcrumbs.add "<script>alert(1)</script>"
194
194
  html = Nokogiri::HTML(@breadcrumbs.render(format: "inline"))
195
195
 
196
196
  assert_empty html.search("script")
197
197
  end
198
198
 
199
- def test_escape_text_when_rendering_list
199
+ test "escapes text when rendering list" do
200
200
  @breadcrumbs.add "<script>alert(1)</script>"
201
201
  html = Nokogiri::HTML(@breadcrumbs.render)
202
202
 
203
203
  assert_empty html.search("script")
204
204
  end
205
+
206
+ test "renders dots as breadcrumb items" do
207
+ @breadcrumbs.add "."
208
+ @breadcrumbs.add ".."
209
+ @breadcrumbs.add "..."
210
+ @breadcrumbs.add ". . ."
211
+ html = Nokogiri::HTML(@breadcrumbs.render)
212
+
213
+ items = html.search("li")
214
+
215
+ assert_equal ".", items[0].inner_text
216
+ assert_equal "..", items[1].inner_text
217
+ assert_equal "...", items[2].inner_text
218
+ assert_equal ". . .", items[3].inner_text
219
+ end
205
220
  end
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pt-BR:
2
3
  people: "Nosso time"
3
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breadcrumbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-24 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -200,11 +200,20 @@ executables: []
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
+ - ".github/CODEOWNERS"
203
204
  - ".github/FUNDING.yml"
205
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
206
+ - ".github/ISSUE_TEMPLATE/config.yml"
207
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
208
+ - ".github/PULL_REQUEST_TEMPLATE.md"
209
+ - ".github/dependabot.yml"
210
+ - ".github/workflows/ruby-tests.yml"
204
211
  - ".gitignore"
205
212
  - ".rubocop.yml"
206
- - ".travis.yml"
213
+ - CODE_OF_CONDUCT.md
214
+ - CONTRIBUTING.md
207
215
  - Gemfile
216
+ - LICENSE.md
208
217
  - README.md
209
218
  - Rakefile
210
219
  - breadcrumbs.gemspec
@@ -269,7 +278,14 @@ files:
269
278
  - test/test_helper.rb
270
279
  homepage: http://rubygems.org/gems/breadcrumbs
271
280
  licenses: []
272
- metadata: {}
281
+ metadata:
282
+ homepage_uri: http://rubygems.org/gems/breadcrumbs
283
+ bug_tracker_uri: https://github.com/fnando/breadcrumbs/issues
284
+ source_code_uri: https://github.com/fnando/breadcrumbs/tree/v0.3.0
285
+ changelog_uri: https://github.com/fnando/breadcrumbs/tree/v0.3.0/CHANGELOG.md
286
+ documentation_uri: https://github.com/fnando/breadcrumbs/tree/v0.3.0/README.md
287
+ license_uri: https://github.com/fnando/breadcrumbs/tree/v0.3.0/LICENSE.md
288
+ rubygems_mfa_required: 'true'
273
289
  post_install_message:
274
290
  rdoc_options: []
275
291
  require_paths:
@@ -278,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
294
  requirements:
279
295
  - - ">="
280
296
  - !ruby/object:Gem::Version
281
- version: 2.5.0
297
+ version: 2.7.0
282
298
  required_rubygems_version: !ruby/object:Gem::Requirement
283
299
  requirements:
284
300
  - - ">="
285
301
  - !ruby/object:Gem::Version
286
302
  version: '0'
287
303
  requirements: []
288
- rubygems_version: 3.1.2
304
+ rubygems_version: 3.3.3
289
305
  signing_key:
290
306
  specification_version: 4
291
307
  summary: Breadcrumbs is a simple plugin that adds a `breadcrumbs` object to controllers
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
- rvm:
5
- - 2.7.1
6
- - 2.6.5
7
- notifications:
8
- email: false
9
- env:
10
- global:
11
- secure: e3cKbK2ru5Wx2Jir+PUUTQFx/lrYESRMhqPPgGQ1Eq6Xc8kQ+ACxuLmgFZEZOD1aUlCVfvm8kpIJ8uVhKystwotjV3ObK2imgWvpoJLfvgIWXZ3dhIWmVI98Da1I2t66LM+1l9LREzQm2bN7zAx7NPr2oRHasDpuNc13BnIcIsg=