iri 0.11.2 → 0.11.3

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: 85b6c4103f0ea74aa2c3a24441bb5be82ef0236a1ef2ee2f31848b4f7e8b9156
4
- data.tar.gz: 305382fc068d8fe5f3b1b081236296ff45b9c700ec87666a2c00e2f9558130d9
3
+ metadata.gz: 755164c02f8e3eedb0f619456647a34b6afa2fbe3a9952a9c0713ace19d3f65f
4
+ data.tar.gz: 13c6308b1efc04762c72bc7de6a4301eb0b8699b75738827b79b601fadc99a7e
5
5
  SHA512:
6
- metadata.gz: 0017afd7454f2c2ce1651a9d8d57209812e760aaa2b6582c183e9eb0142f66dd3ca464296c15aa8391d7947a5c39dd7ee172d8dd86285966df5e9a1e3ea255e2
7
- data.tar.gz: 54d925acb96ba79905e2fd03ec2c300f1121b37923789a4054150e5e65c3c98b042117452121ce0567e368c596cee0c18628dace289d8f8947e4688e055889dc
6
+ metadata.gz: 291cd47c6d1a44ff2fa6d9bc962ddff66457e4363c6595d9993170ee8446d30948e5aee0a950993558fe143f0a2eadc0052e5774a66be7325e63d822e2467838
7
+ data.tar.gz: e5bcfba5c59c5bb0bea31e00e609751654c982853aa756eb5e522bc9998066f6999a83ecf440b1a3bbbc8bdc935cec2b3a423640c5d4eb581894a52f8063c07a
data/Gemfile CHANGED
@@ -9,11 +9,11 @@ gemspec
9
9
  gem 'minitest', '~>5.25', require: false
10
10
  gem 'minitest-reporters', '~>1.7', require: false
11
11
  gem 'rake', '~>13.2', require: false
12
+ gem 'rdoc', '6.15.0', require: false # GPL
12
13
  gem 'rubocop', '~>1.74', require: false
13
- gem 'rubocop-minitest', '>0', require: false
14
- gem 'rubocop-performance', '>0', require: false
15
- gem 'rubocop-rake', '>0', require: false
16
- gem 'rubocop-rspec', '>0', require: false
14
+ gem 'rubocop-minitest', '~>0.38', require: false
15
+ gem 'rubocop-performance', '~>1.25', require: false
16
+ gem 'rubocop-rake', '~>0.7', require: false
17
17
  gem 'simplecov', '~>0.22', require: false
18
- gem 'simplecov-cobertura', '~>2.1', require: false
18
+ gem 'simplecov-cobertura', '~>3.0', require: false
19
19
  gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -9,27 +9,36 @@ GEM
9
9
  ansi (1.5.0)
10
10
  ast (2.4.3)
11
11
  builder (3.3.0)
12
+ date (3.5.0)
12
13
  docile (1.4.1)
13
- json (2.12.2)
14
+ erb (6.0.0)
15
+ json (2.16.0)
14
16
  language_server-protocol (3.17.0.5)
15
17
  lint_roller (1.1.0)
16
- minitest (5.25.5)
18
+ minitest (5.26.1)
17
19
  minitest-reporters (1.7.1)
18
20
  ansi
19
21
  builder
20
22
  minitest (>= 5.0)
21
23
  ruby-progressbar
22
24
  parallel (1.27.0)
23
- parser (3.3.8.0)
25
+ parser (3.3.10.0)
24
26
  ast (~> 2.4.1)
25
27
  racc
26
- prism (1.4.0)
28
+ prism (1.6.0)
29
+ psych (5.2.6)
30
+ date
31
+ stringio
27
32
  racc (1.8.1)
28
33
  rainbow (3.1.1)
29
- rake (13.3.0)
30
- regexp_parser (2.10.0)
31
- rexml (3.4.1)
32
- rubocop (1.75.8)
34
+ rake (13.3.1)
35
+ rdoc (6.15.0)
36
+ erb
37
+ psych (>= 4.0.0)
38
+ tsort
39
+ regexp_parser (2.11.3)
40
+ rexml (3.4.4)
41
+ rubocop (1.81.7)
33
42
  json (~> 2.3)
34
43
  language_server-protocol (~> 3.17.0.2)
35
44
  lint_roller (~> 1.1.0)
@@ -37,39 +46,38 @@ GEM
37
46
  parser (>= 3.3.0.2)
38
47
  rainbow (>= 2.2.2, < 4.0)
39
48
  regexp_parser (>= 2.9.3, < 3.0)
40
- rubocop-ast (>= 1.44.0, < 2.0)
49
+ rubocop-ast (>= 1.47.1, < 2.0)
41
50
  ruby-progressbar (~> 1.7)
42
51
  unicode-display_width (>= 2.4.0, < 4.0)
43
- rubocop-ast (1.44.1)
52
+ rubocop-ast (1.48.0)
44
53
  parser (>= 3.3.7.2)
45
54
  prism (~> 1.4)
46
- rubocop-minitest (0.38.1)
55
+ rubocop-minitest (0.38.2)
47
56
  lint_roller (~> 1.1)
48
57
  rubocop (>= 1.75.0, < 2.0)
49
58
  rubocop-ast (>= 1.38.0, < 2.0)
50
- rubocop-performance (1.25.0)
59
+ rubocop-performance (1.26.1)
51
60
  lint_roller (~> 1.1)
52
61
  rubocop (>= 1.75.0, < 2.0)
53
- rubocop-ast (>= 1.38.0, < 2.0)
62
+ rubocop-ast (>= 1.47.1, < 2.0)
54
63
  rubocop-rake (0.7.1)
55
64
  lint_roller (~> 1.1)
56
65
  rubocop (>= 1.72.1)
57
- rubocop-rspec (3.6.0)
58
- lint_roller (~> 1.1)
59
- rubocop (~> 1.72, >= 1.72.1)
60
66
  ruby-progressbar (1.13.0)
61
67
  simplecov (0.22.0)
62
68
  docile (~> 1.1)
63
69
  simplecov-html (~> 0.11)
64
70
  simplecov_json_formatter (~> 0.1)
65
- simplecov-cobertura (2.1.0)
71
+ simplecov-cobertura (3.1.0)
66
72
  rexml
67
73
  simplecov (~> 0.19)
68
- simplecov-html (0.13.1)
74
+ simplecov-html (0.13.2)
69
75
  simplecov_json_formatter (0.1.4)
70
- unicode-display_width (3.1.4)
71
- unicode-emoji (~> 4.0, >= 4.0.4)
72
- unicode-emoji (4.0.4)
76
+ stringio (3.1.8)
77
+ tsort (0.2.0)
78
+ unicode-display_width (3.2.0)
79
+ unicode-emoji (~> 4.1)
80
+ unicode-emoji (4.1.0)
73
81
  yard (0.9.37)
74
82
 
75
83
  PLATFORMS
@@ -83,13 +91,13 @@ DEPENDENCIES
83
91
  minitest (~> 5.25)
84
92
  minitest-reporters (~> 1.7)
85
93
  rake (~> 13.2)
94
+ rdoc (= 6.15.0)
86
95
  rubocop (~> 1.74)
87
- rubocop-minitest (> 0)
88
- rubocop-performance (> 0)
89
- rubocop-rake (> 0)
90
- rubocop-rspec (> 0)
96
+ rubocop-minitest (~> 0.38)
97
+ rubocop-performance (~> 1.25)
98
+ rubocop-rake (~> 0.7)
91
99
  simplecov (~> 0.22)
92
- simplecov-cobertura (~> 2.1)
100
+ simplecov-cobertura (~> 3.0)
93
101
  yard (~> 0.9)
94
102
 
95
103
  BUNDLED WITH
data/README.md CHANGED
@@ -12,9 +12,8 @@
12
12
  [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/iri.svg)](https://codecov.io/github/yegor256/iri?branch=master)
13
13
  [![Hits-of-Code](https://hitsofcode.com/github/yegor256/iri)](https://hitsofcode.com/view/github/yegor256/iri)
14
14
 
15
- The class [`Iri`](https://www.rubydoc.info/github/yegor256/iri/master/Iri)
16
- helps you build a URI and then modify its
17
- parts via a simple [fluent interface]:
15
+ The class [Iri] helps you build a URI and then modify its
16
+ parts via a simple [fluent interface]:
18
17
 
19
18
  ```ruby
20
19
  require 'iri'
@@ -84,4 +83,5 @@ bundle exec rake
84
83
 
85
84
  If it's clean and you don't see any error messages, submit your pull request.
86
85
 
86
+ [Iri]: https://www.rubydoc.info/github/yegor256/iri/master/Iri
87
87
  [fluent interface]: https://en.wikipedia.org/wiki/Fluent_interface
data/Rakefile CHANGED
@@ -30,6 +30,7 @@ require 'yard'
30
30
  desc 'Build Yard documentation'
31
31
  YARD::Rake::YardocTask.new do |t|
32
32
  t.files = ['lib/**/*.rb']
33
+ t.options = ['--fail-on-warning']
33
34
  end
34
35
 
35
36
  require 'rubocop/rake_task'
data/iri.gemspec CHANGED
@@ -4,21 +4,23 @@
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
6
  require 'English'
7
+
7
8
  Gem::Specification.new do |s|
8
9
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
9
10
  s.required_ruby_version = '>=2.2'
10
11
  s.name = 'iri'
11
- s.version = '0.11.2'
12
+ s.version = '0.11.3'
12
13
  s.license = 'MIT'
13
14
  s.summary = 'Simple Immutable Ruby URI Builder'
14
- s.description = "Class Iri helps you build a URI and then modify its \
15
- parts via a simple immutable fluent interface. It always returns a new \
16
- object instead of changing the existing one. This makes the object \
17
- safer and much easier for reuse."
15
+ s.description =
16
+ 'Class Iri helps you build a URI and then modify its ' \
17
+ 'parts via a simple immutable fluent interface. It always returns a new ' \
18
+ 'object instead of changing the existing one. This makes the object ' \
19
+ 'safer and much easier for reuse.'
18
20
  s.authors = ['Yegor Bugayenko']
19
21
  s.email = 'yegor256@gmail.com'
20
22
  s.homepage = 'https://github.com/yegor256/iri'
21
- s.files = `git ls-files`.split($RS)
23
+ s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
22
24
  s.rdoc_options = ['--charset=UTF-8']
23
25
  s.extra_rdoc_files = ['README.md']
24
26
  s.metadata['rubygems_mfa_required'] = 'true'
data/lib/iri.rb CHANGED
@@ -143,6 +143,7 @@ class Iri
143
143
  raise InvalidArguments unless hash.is_a?(Hash)
144
144
  modify_query do |params|
145
145
  hash.each do |k, v|
146
+ next if v.nil?
146
147
  params[k.to_s] = [] unless params[k.to_s]
147
148
  params[k.to_s] << v
148
149
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -18,22 +18,6 @@ extensions: []
18
18
  extra_rdoc_files:
19
19
  - README.md
20
20
  files:
21
- - ".0pdd.yml"
22
- - ".gitattributes"
23
- - ".github/workflows/actionlint.yml"
24
- - ".github/workflows/codecov.yml"
25
- - ".github/workflows/copyrights.yml"
26
- - ".github/workflows/markdown-lint.yml"
27
- - ".github/workflows/pdd.yml"
28
- - ".github/workflows/rake.yml"
29
- - ".github/workflows/reuse.yml"
30
- - ".github/workflows/typos.yml"
31
- - ".github/workflows/xcop.yml"
32
- - ".github/workflows/yamllint.yml"
33
- - ".gitignore"
34
- - ".pdd"
35
- - ".rubocop.yml"
36
- - ".rultor.yml"
37
21
  - Gemfile
38
22
  - Gemfile.lock
39
23
  - LICENSE.txt
@@ -44,9 +28,6 @@ files:
44
28
  - iri.gemspec
45
29
  - lib/iri.rb
46
30
  - logo.svg
47
- - renovate.json
48
- - test/test__helper.rb
49
- - test/test_iri.rb
50
31
  homepage: https://github.com/yegor256/iri
51
32
  licenses:
52
33
  - MIT
@@ -67,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
48
  - !ruby/object:Gem::Version
68
49
  version: '0'
69
50
  requirements: []
70
- rubygems_version: 3.6.7
51
+ rubygems_version: 3.6.9
71
52
  specification_version: 4
72
53
  summary: Simple Immutable Ruby URI Builder
73
54
  test_files: []
data/.0pdd.yml DELETED
@@ -1,8 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- errors:
5
- - yegor256@gmail.com
6
- tags:
7
- - pdd
8
- - bug
data/.gitattributes DELETED
@@ -1,7 +0,0 @@
1
- # Check out all text files in UNIX format, with LF as end of line
2
- # Don't change this file. If you have any ideas about it, please
3
- # submit a separate issue about it and we'll discuss.
4
-
5
- * text=auto eol=lf
6
- *.java ident
7
- *.xml ident
@@ -1,25 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: actionlint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- actionlint:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - name: Download actionlint
20
- id: get_actionlint
21
- run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
22
- shell: bash
23
- - name: Check workflow files
24
- run: ${{ steps.get_actionlint.outputs.executable }} -color
25
- shell: bash
@@ -1,27 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: codecov
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- codecov:
12
- timeout-minutes: 15
13
- runs-on: ubuntu-24.04
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 3.3
19
- bundler-cache: true
20
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
21
- - run: bundle install --no-color
22
- - run: bundle exec rake
23
- - uses: codecov/codecov-action@v5
24
- with:
25
- token: ${{ secrets.CODECOV_TOKEN }}
26
- files: coverage/.resultset.json
27
- fail_ci_if_error: true
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: copyrights
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- copyrights:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: yegor256/copyrights-action@0.0.12
@@ -1,23 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: markdown-lint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- paths-ignore: ['paper/**', 'sandbox/**']
14
- concurrency:
15
- group: markdown-lint-${{ github.ref }}
16
- cancel-in-progress: true
17
- jobs:
18
- markdown-lint:
19
- timeout-minutes: 15
20
- runs-on: ubuntu-24.04
21
- steps:
22
- - uses: actions/checkout@v4
23
- - uses: DavidAnson/markdownlint-cli2-action@v20.0.0
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: pdd
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- pdd:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: volodya-lombrozo/pdd-action@master
@@ -1,28 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: rake
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- test:
15
- strategy:
16
- matrix:
17
- os: [ubuntu-24.04, macos-15, windows-2022]
18
- ruby: [3.3]
19
- runs-on: ${{ matrix.os }}
20
- steps:
21
- - uses: actions/checkout@v4
22
- - uses: ruby/setup-ruby@v1
23
- with:
24
- ruby-version: ${{ matrix.ruby }}
25
- bundler-cache: true
26
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
27
- - run: bundle install --no-color
28
- - run: bundle exec rake
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: reuse
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- reuse:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: fsfe/reuse-action@v5
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: typos
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- typos:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: crate-ci/typos@v1.32.0
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: xcop
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- xcop:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: g4s8/xcop-action@master
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: yamllint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- yamllint:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: ibiqlik/action-yamllint@v3
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- .bundle/
2
- .DS_Store
3
- .idea/
4
- .yardoc/
5
- *.gem
6
- coverage/
7
- doc/
8
- node_modules/
9
- rdoc/
10
- vendor/
11
- .claude/
data/.pdd DELETED
@@ -1,5 +0,0 @@
1
- --source=.
2
- --verbose
3
- --rule min-words:20
4
- --rule min-estimate:15
5
- --rule max-estimate:90
data/.rubocop.yml DELETED
@@ -1,30 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- AllCops:
5
- DisplayCopNames: true
6
- TargetRubyVersion: 2.2
7
- SuggestExtensions: false
8
- NewCops: enable
9
- plugins:
10
- - rubocop-minitest
11
- - rubocop-performance
12
- - rubocop-rake
13
- Minitest/EmptyLineBeforeAssertionMethods:
14
- Enabled: false
15
- Metrics/ClassLength:
16
- Max: 250
17
- Layout/EmptyLineAfterGuardClause:
18
- Enabled: false
19
- Layout/MultilineMethodCallIndentation:
20
- Enabled: false
21
- Metrics/AbcSize:
22
- Max: 30
23
- Metrics/MethodLength:
24
- Max: 30
25
- Metrics/CyclomaticComplexity:
26
- Max: 12
27
- Metrics/PerceivedComplexity:
28
- Max: 12
29
- Layout/EndOfLine:
30
- EnforcedStyle: lf
data/.rultor.yml DELETED
@@ -1,26 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- docker:
6
- image: yegor256/ruby
7
- assets:
8
- rubygems.yml: yegor256/home#assets/rubygems.yml
9
- install: |-
10
- pdd -f /dev/null
11
- bundle install --no-color
12
- release:
13
- pre: false
14
- script: |-
15
- [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
16
- bundle exec rake
17
- rm -rf *.gem
18
- sed -i "s/0\.0\.0/${tag}/g" iri.gemspec
19
- git add iri.gemspec
20
- git commit -m "Version set to ${tag}"
21
- gem build iri.gemspec
22
- chmod 0600 ../rubygems.yml
23
- gem push *.gem --config-file ../rubygems.yml
24
- merge:
25
- script: |-
26
- bundle exec rake
data/renovate.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base"
5
- ]
6
- }
data/test/test__helper.rb DELETED
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
- # SPDX-License-Identifier: MIT
5
-
6
- $stdout.sync = true
7
-
8
- require 'simplecov'
9
- require 'simplecov-cobertura'
10
- unless SimpleCov.running
11
- SimpleCov.command_name('test')
12
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
13
- [
14
- SimpleCov::Formatter::HTMLFormatter,
15
- SimpleCov::Formatter::CoberturaFormatter
16
- ]
17
- )
18
- SimpleCov.minimum_coverage 100
19
- SimpleCov.minimum_coverage_by_file 100
20
- SimpleCov.start do
21
- add_filter 'test/'
22
- add_filter 'vendor/'
23
- add_filter 'target/'
24
- track_files 'lib/**/*.rb'
25
- track_files '*.rb'
26
- end
27
- end
28
-
29
- require 'minitest/autorun'
30
- require 'minitest/reporters'
31
- Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
data/test/test_iri.rb DELETED
@@ -1,270 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
4
- # SPDX-License-Identifier: MIT
5
-
6
- require_relative '../test/test__helper'
7
- require_relative '../lib/iri'
8
-
9
- # Iri test.
10
- # Author:: Yegor Bugayenko (yegor256@gmail.com)
11
- # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
12
- # License:: MIT
13
- class IriTest < Minitest::Test
14
- def test_builds_uri
15
- url = Iri.new('http://google.com/')
16
- .add(q: 'books about OOP', limit: 50)
17
- .del(:q)
18
- .del('limit')
19
- .over(q: 'books about tennis', limit: 10)
20
- .scheme('https')
21
- .host('localhost')
22
- .port(8080)
23
- .to_s
24
- assert_equal('https://localhost:8080/?q=books+about+tennis&limit=10', url)
25
- end
26
-
27
- def test_converts_to_uri
28
- assert_equal(
29
- 'https://alpha.local?t=1',
30
- Iri.new('https://alpha.local').over(t: 1).to_uri.to_s
31
- )
32
- end
33
-
34
- def test_hides_https_port_number
35
- assert_equal(
36
- 'https://google.com/abc',
37
- Iri.new('https://google.com').port(443).append('abc').to_s
38
- )
39
- end
40
-
41
- def test_converts_to_local
42
- {
43
- 'http://localhost:9292/' => '/',
44
- 'https://google.com/' => '/',
45
- 'https://google.com/foo' => '/foo',
46
- 'https://google.com/bar?x=900' => '/bar?x=900',
47
- 'https://google.com/what#yes' => '/what#yes',
48
- 'https://google.com/what?a=8&b=9#yes' => '/what?a=8&b=9#yes'
49
- }.each { |a, b| assert_equal(b, Iri.new(a).to_local.to_s) }
50
- end
51
-
52
- def test_deals_with_local
53
- assert_equal('/foo?x=1', Iri.new('https://google.com/foo').to_local.add(x: 1).to_s)
54
- end
55
-
56
- def test_broken_uri
57
- assert_raises Iri::InvalidURI do
58
- Iri.new('https://example.com/>', safe: false).add(a: 1)
59
- end
60
- end
61
-
62
- def test_incorrect_call_of_add
63
- assert_raises Iri::InvalidArguments do
64
- Iri.new('https://example.com/').add('hello5')
65
- end
66
- end
67
-
68
- def test_incorrect_call_of_over
69
- assert_raises Iri::InvalidArguments do
70
- Iri.new('https://example5.com/').over('boom44')
71
- end
72
- end
73
-
74
- def test_broken_uri_in_safe_mode
75
- Iri.new('https://example.com/>>>').add(a: 1)
76
- end
77
-
78
- def test_starts_with_empty_uri
79
- assert_equal(
80
- 'https:',
81
- Iri.new.scheme('https').to_s
82
- )
83
- end
84
-
85
- def test_inspects_iri
86
- assert_equal(
87
- '"https://openai.com"',
88
- Iri.new('https://openai.com').inspect
89
- )
90
- end
91
-
92
- def test_replaces_scheme
93
- assert_equal(
94
- 'https://google.com/',
95
- Iri.new('http://google.com/').scheme('https').to_s
96
- )
97
- end
98
-
99
- def test_replaces_host
100
- assert_equal(
101
- 'http://localhost/',
102
- Iri.new('http://google.com/').host('localhost').to_s
103
- )
104
- end
105
-
106
- def test_replaces_port
107
- assert_equal(
108
- 'http://localhost:443/',
109
- Iri.new('http://localhost/').port(443).to_s
110
- )
111
- end
112
-
113
- def test_replaces_fragment
114
- assert_equal(
115
- 'http://localhost/a/b#test%20me',
116
- Iri.new('http://localhost/a/b#before').fragment('test me').to_s
117
- )
118
- assert_equal(
119
- 'http://localhost/#42',
120
- Iri.new('http://localhost/').fragment(42).to_s
121
- )
122
- end
123
-
124
- def test_sets_path
125
- assert_equal(
126
- 'http://localhost/hey/you?i=8#test',
127
- Iri.new('http://localhost/hey?i=8#test').path('/hey/you').to_s
128
- )
129
- end
130
-
131
- def test_sets_query
132
- assert_equal(
133
- 'http://localhost/hey?t=1#test',
134
- Iri.new('http://localhost/hey?i=8#test').query('t=1').to_s
135
- )
136
- end
137
-
138
- def test_removes_path
139
- assert_equal(
140
- 'http://localhost/',
141
- Iri.new('http://localhost/hey?i=8#test').cut.to_s
142
- )
143
- end
144
-
145
- def test_adds_query_param
146
- assert_equal(
147
- 'http://google/?a=1&a=3&b=2',
148
- Iri.new('http://google/').add(a: 1, b: 2).add(a: 3).to_s
149
- )
150
- assert_equal(
151
- 'http://google/?%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82+%D0%B4%D1%80%D1%83%D0%B3=%D0%BA%D0%B0%D0%BA+%D0%B4%D0%B5%D0%BB%D0%B0%3F',
152
- Iri.new('http://google/').add('привет друг' => 'как дела?').to_s
153
- )
154
- end
155
-
156
- def test_removes_query_param
157
- assert_equal(
158
- 'http://google/?b=2&c=3',
159
- Iri.new('http://google/?a=1&b=2&c=3&a=3').del('a').del('x').to_s
160
- )
161
- end
162
-
163
- def test_appends_path
164
- assert_equal(
165
- 'http://google/a/b/z+%2F+7/42?x=3',
166
- Iri.new('http://google/a/b?x=3').append('z / 7').append(42.to_s).to_s
167
- )
168
- end
169
-
170
- def test_appends_to_empty_ending
171
- assert_equal(
172
- 'http://google.com/hello',
173
- Iri.new('http://google.com/').append('hello').to_s
174
- )
175
- end
176
-
177
- def test_appends_empty_path
178
- assert_equal(
179
- 'http://google.com/test',
180
- Iri.new('http://google.com/hello').cut.append('test').to_s
181
- )
182
- end
183
-
184
- def test_replaces_query_param
185
- assert_equal(
186
- 'http://google/?a=hey&b=2&c=3',
187
- Iri.new('http://google/?a=1&b=2&c=3&a=33').over(a: 'hey').to_s
188
- )
189
- end
190
-
191
- def test_rejects_nil_uri
192
- assert_raises ArgumentError do
193
- Iri.new(nil)
194
- end
195
- end
196
-
197
- def test_rejects_nil_scheme
198
- assert_raises ArgumentError do
199
- Iri.new('http://google.com').scheme(nil)
200
- end
201
- end
202
-
203
- def test_rejects_nil_host
204
- assert_raises ArgumentError do
205
- Iri.new('http://google.com').host(nil)
206
- end
207
- end
208
-
209
- def test_rejects_nil_port
210
- assert_raises ArgumentError do
211
- Iri.new('http://google.com').port(nil)
212
- end
213
- end
214
-
215
- def test_rejects_nil_path
216
- assert_raises ArgumentError do
217
- Iri.new('http://google.com').path(nil)
218
- end
219
- end
220
-
221
- def test_rejects_nil_fragment
222
- assert_raises ArgumentError do
223
- Iri.new('http://google.com').fragment(nil)
224
- end
225
- end
226
-
227
- def test_rejects_nil_query
228
- assert_raises ArgumentError do
229
- Iri.new('http://google.com').query(nil)
230
- end
231
- end
232
-
233
- def test_rejects_nil_cut_path
234
- assert_raises ArgumentError do
235
- Iri.new('http://google.com/foo').cut(nil)
236
- end
237
- end
238
-
239
- def test_rejects_nil_append_part
240
- assert_raises ArgumentError do
241
- Iri.new('http://google.com').append(nil)
242
- end
243
- end
244
-
245
- def test_rejects_nil_add_hash
246
- assert_raises ArgumentError do
247
- Iri.new('http://google.com').add(nil)
248
- end
249
- end
250
-
251
- def test_rejects_nil_over_hash
252
- assert_raises ArgumentError do
253
- Iri.new('http://google.com').over(nil)
254
- end
255
- end
256
-
257
- def test_with_alias_for_add
258
- assert_equal(
259
- 'http://google.com?q=test&limit=10',
260
- Iri.new('http://google.com').with(q: 'test', limit: 10).to_s
261
- )
262
- end
263
-
264
- def test_without_alias_for_del
265
- assert_equal(
266
- 'http://google.com/?b=2',
267
- Iri.new('http://google.com/?a=1&b=2&c=3').without(:a, :c).to_s
268
- )
269
- end
270
- end