minitest-keyword 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c39c38c1db2e8fc84c8d158a55722fa5813aaf374eb4f1829b8c2e986f8d34da
4
- data.tar.gz: 131b9d624e2be66040e3302f3b27111a6d3047c334375b311d647c44865218fe
3
+ metadata.gz: 70d8098146612cfca7688027b68ad119cec7304cf2d57e4a53917d1c6768de4b
4
+ data.tar.gz: e42b3dc2b49e40ce56fd354cba7bf00de356c9204e9e4bdf1819db86ad47a9d3
5
5
  SHA512:
6
- metadata.gz: 00df43e2354c98ef45515085cd55fef8331e429a35a5f170799b6f172f5aa5b9796099a83522c4074fc160bdb10b18db68ec7e379f11d9185e75dba988f5b5a6
7
- data.tar.gz: 8d680815333dfc6a51d8fb4478ef25d11f279d53f713e4b930bcc48b3c5c4054239bf9c1813f4ae2cda07ad32246e3f553d74704fadbb4a57ca3c32a96059771
6
+ metadata.gz: bfbf23bf6c7e1d70c39b67280c48eb5384133af034f6da161a4fd1e7dc6a8bf9cf1661d73eee722779cad1a755e743f1490c01d1a51584340697a87dcca7719e
7
+ data.tar.gz: 96ee9c50998942a3b4f9f3c7f2dca57b9373efe73d13899866c8e1ba3eb6f68e3e3f954b34bd4125dca89dace6edf4e42df6d7e93b47eaba3cae68270586e913
@@ -4,3 +4,7 @@ updates:
4
4
  directory: "/"
5
5
  schedule:
6
6
  interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
@@ -0,0 +1,22 @@
1
+ name: Dependabot auto-merge
2
+ on: pull_request
3
+
4
+ permissions:
5
+ contents: write
6
+ pull-requests: write
7
+
8
+ jobs:
9
+ dependabot:
10
+ runs-on: ubuntu-latest
11
+ if: ${{ github.actor == 'dependabot[bot]' }}
12
+ steps:
13
+ - name: Dependabot metadata
14
+ id: metadata
15
+ uses: dependabot/fetch-metadata@v1.6.0
16
+ with:
17
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
18
+ - name: Enable auto-merge for Dependabot PRs
19
+ run: gh pr merge --auto --merge "$PR_URL"
20
+ env:
21
+ PR_URL: ${{github.event.pull_request.html_url}}
22
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -1,7 +1,9 @@
1
1
  name: Main
2
+
2
3
  on:
3
4
  - push
4
- - pull_request_target
5
+ - pull_request
6
+
5
7
  jobs:
6
8
  ci:
7
9
  name: CI
@@ -12,23 +14,10 @@ jobs:
12
14
  - uses: actions/checkout@master
13
15
  - uses: ruby/setup-ruby@v1
14
16
  with:
15
- ruby-version: 3.0
17
+ ruby-version: '3.2'
16
18
  bundler-cache: true
17
19
  - name: Lint and test
18
20
  run: |
21
+ bundle exec rake stree:check
19
22
  bundle exec rubocop --parallel
20
23
  bundle exec rake test
21
- automerge:
22
- name: AutoMerge
23
- needs: ci
24
- runs-on: ubuntu-latest
25
- if: github.event_name == 'pull_request_target' && (github.actor == github.repository_owner || github.actor == 'dependabot[bot]')
26
- steps:
27
- - uses: actions/github-script@v3
28
- with:
29
- script: |
30
- github.pulls.merge({
31
- owner: context.payload.repository.owner.login,
32
- repo: context.payload.repository.name,
33
- pull_number: context.payload.pull_request.number
34
- })
data/.rubocop.yml CHANGED
@@ -1,13 +1,27 @@
1
+ inherit_gem:
2
+ syntax_tree: config/rubocop.yml
3
+
1
4
  AllCops:
2
5
  DisplayCopNames: true
3
6
  DisplayStyleGuide: true
7
+ NewCops: enable
8
+ SuggestExtensions: false
4
9
  TargetRubyVersion: 2.7
5
10
  Exclude:
6
11
  - '{tmp,vendor,yard}/**/*'
7
12
 
13
+ Gemspec/DevelopmentDependencies:
14
+ Enabled: false
15
+
8
16
  Gemspec/RequiredRubyVersion:
9
17
  Enabled: false
10
18
 
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+
22
+ Metrics/MethodLength:
23
+ Enabled: false
24
+
11
25
  Layout/LineLength:
12
26
  Max: 80
13
27
 
data/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.2] - 2024-01-23
10
+
11
+ ### Changed
12
+
13
+ - Support keyword arguments for `assert_respond_to` and `refute_respond_to`.
14
+
9
15
  ## [1.0.1] - 2021-11-17
10
16
 
11
17
  ### Changed
@@ -18,6 +24,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
18
24
 
19
25
  - The name of the underlying parameter changed for `assert_in_epsilon` from `a` and `b` to `exp` and `act`. As such, in order to normalize, those were aliased to `expected` and `actual` as well.
20
26
 
21
- [unreleased]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.1...HEAD
27
+ [unreleased]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.2...HEAD
28
+ [1.0.2]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.1...v1.0.2
22
29
  [1.0.1]: https://github.com/kddnewton/minitest-keyword/compare/v1.0.0...v1.0.1
23
30
  [1.0.0]: https://github.com/kddnewton/minitest-keyword/compare/846f1f...v1.0.0
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-keyword (1.0.1)
4
+ minitest-keyword (1.0.2)
5
5
  minitest (~> 5.0)
6
6
 
7
7
  GEM
@@ -9,33 +9,42 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  docile (1.4.0)
12
- minitest (5.14.4)
13
- parallel (1.21.0)
14
- parser (3.0.2.0)
12
+ json (2.7.1)
13
+ language_server-protocol (3.17.0.3)
14
+ minitest (5.21.1)
15
+ parallel (1.24.0)
16
+ parser (3.3.0.3)
15
17
  ast (~> 2.4.1)
16
- rainbow (3.0.0)
17
- rake (13.0.6)
18
- regexp_parser (2.1.1)
19
- rexml (3.2.5)
20
- rubocop (1.23.0)
18
+ racc
19
+ prettier_print (1.2.1)
20
+ racc (1.7.3)
21
+ rainbow (3.1.1)
22
+ rake (13.1.0)
23
+ regexp_parser (2.9.0)
24
+ rexml (3.2.6)
25
+ rubocop (1.59.0)
26
+ json (~> 2.3)
27
+ language_server-protocol (>= 3.17.0)
21
28
  parallel (~> 1.10)
22
- parser (>= 3.0.0.0)
29
+ parser (>= 3.2.2.4)
23
30
  rainbow (>= 2.2.2, < 4.0)
24
31
  regexp_parser (>= 1.8, < 3.0)
25
- rexml
26
- rubocop-ast (>= 1.12.0, < 2.0)
32
+ rexml (>= 3.2.5, < 4.0)
33
+ rubocop-ast (>= 1.30.0, < 2.0)
27
34
  ruby-progressbar (~> 1.7)
28
- unicode-display_width (>= 1.4.0, < 3.0)
29
- rubocop-ast (1.13.0)
30
- parser (>= 3.0.1.1)
31
- ruby-progressbar (1.11.0)
32
- simplecov (0.21.2)
35
+ unicode-display_width (>= 2.4.0, < 3.0)
36
+ rubocop-ast (1.30.0)
37
+ parser (>= 3.2.1.0)
38
+ ruby-progressbar (1.13.0)
39
+ simplecov (0.22.0)
33
40
  docile (~> 1.1)
34
41
  simplecov-html (~> 0.11)
35
42
  simplecov_json_formatter (~> 0.1)
36
43
  simplecov-html (0.12.3)
37
- simplecov_json_formatter (0.1.3)
38
- unicode-display_width (2.1.0)
44
+ simplecov_json_formatter (0.1.4)
45
+ syntax_tree (6.2.0)
46
+ prettier_print (>= 1.2.0)
47
+ unicode-display_width (2.5.0)
39
48
 
40
49
  PLATFORMS
41
50
  ruby
@@ -46,6 +55,7 @@ DEPENDENCIES
46
55
  rake (~> 13.0)
47
56
  rubocop (~> 1.12)
48
57
  simplecov (~> 0.17)
58
+ syntax_tree
49
59
 
50
60
  BUNDLED WITH
51
- 2.2.15
61
+ 2.4.1
data/README.md CHANGED
@@ -10,7 +10,7 @@ A small gem for allowing you to use Minitest assertions with keyword arguments.
10
10
  Add this line to your application's Gemfile:
11
11
 
12
12
  ```ruby
13
- gem 'minitest-keyword'
13
+ gem "minitest-keyword"
14
14
  ```
15
15
 
16
16
  And then execute:
@@ -23,16 +23,16 @@ Or install it yourself as:
23
23
 
24
24
  ## Usage
25
25
 
26
- Add `require 'minitest/keyword'` to your `test_helper.rb` script. In your tests you will now be able to change your assertions from:
26
+ Add `require "minitest/keyword"` to your `test_helper.rb` script. In your tests you will now be able to change your assertions from:
27
27
 
28
28
  ```ruby
29
- assert_equal 'foo', foo.inspect
29
+ assert_equal "foo", foo.inspect
30
30
  ```
31
31
 
32
32
  to:
33
33
 
34
34
  ```ruby
35
- assert_equal expected: 'foo', actual: foo.inspect
35
+ assert_equal expected: "foo", actual: foo.inspect
36
36
  ```
37
37
 
38
38
  All of the standard Minitest assertions can now be used with keyword arguments. Note that this gem is still backwards-compatible with Minitest itself, so your existing tests won't break.
data/Rakefile CHANGED
@@ -1,12 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "syntax_tree/rake_tasks"
5
6
 
6
7
  Rake::TestTask.new(:test) do |t|
7
- t.libs << 'test'
8
- t.libs << 'lib'
9
- t.test_files = FileList['test/**/*_test.rb']
8
+ t.libs << "test"
9
+ t.libs << "lib"
10
+ t.test_files = FileList["test/**/*_test.rb"]
10
11
  end
11
12
 
12
13
  task default: :test
14
+
15
+ configure = ->(task) do
16
+ task.source_files =
17
+ FileList[%w[Gemfile Rakefile *.gemspec lib/**/*.rb test/**/*.rb]]
18
+ end
19
+
20
+ SyntaxTree::Rake::CheckTask.new(&configure)
21
+ SyntaxTree::Rake::WriteTask.new(&configure)
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/setup'
5
- require 'minitest/keyword'
4
+ require "bundler/setup"
5
+ require "minitest/keyword"
6
6
 
7
- require 'irb'
7
+ require "irb"
8
8
  IRB.start(__FILE__)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Keyword
5
- VERSION = '1.0.1'
5
+ VERSION = "1.0.2"
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'minitest'
4
- require 'minitest/keyword/version'
3
+ require "minitest"
4
+ require "minitest/keyword/version"
5
5
 
6
6
  module Minitest
7
7
  # The module containing overridden assertion methods that will be prepended
@@ -24,8 +24,10 @@ module Minitest
24
24
  # keyword arguments
25
25
  class OverloadedArgumentError < ArgumentError
26
26
  def initialize(method_name, argument_name)
27
- super('Cannot specify keyword argument and pass regular argument to ' \
28
- "#{method_name} for argument #{argument_name}")
27
+ super(
28
+ "Cannot specify keyword argument and pass regular argument to " \
29
+ "#{method_name} for argument #{argument_name}"
30
+ )
29
31
  end
30
32
  end
31
33
 
@@ -33,46 +35,59 @@ module Minitest
33
35
  # regular argument or a keyword argument
34
36
  class MissingRequiredArgumentError < ArgumentError
35
37
  def initialize(method_name, argument_name)
36
- super("You must specify a value for the #{argument_name} argument " \
37
- "for the #{method_name} assertion")
38
+ super(
39
+ "You must specify a value for the #{argument_name} argument " \
40
+ "for the #{method_name} assertion"
41
+ )
38
42
  end
39
43
  end
40
44
 
41
- Assertions.instance_methods.grep(/assert|refute/).each do |method_name|
42
- parameters = Assertions.instance_method(method_name).parameters
45
+ Assertions
46
+ .instance_methods
47
+ .grep(/assert|refute/)
48
+ .each do |method_name|
49
+ parameters = Assertions.instance_method(method_name).parameters
50
+ next if parameters.empty?
43
51
 
44
- # This check here for methods like `assert_silent`
45
- next if parameters.empty?
52
+ define_method(method_name) do |*args, **kwargs, &block|
53
+ passed_args = []
54
+ passed_kwargs = {}
46
55
 
47
- # rubocop:disable Metrics/MethodLength
48
- define_method(method_name) do |*args, **kwargs, &block|
49
- passed_params = []
56
+ parameters.each.with_index do |(type, arg_name), index|
57
+ if args.length > index &&
58
+ (kwargs.key?(arg_name) || kwargs.key?(ALIASES[arg_name]))
59
+ raise OverloadedArgumentError.new(method_name, arg_name)
60
+ end
50
61
 
51
- parameters.each.with_index do |(type, arg_name), index|
52
- if args.length > index &&
53
- (kwargs.key?(arg_name) || kwargs.key?(ALIASES[arg_name]))
54
- raise OverloadedArgumentError.new(method_name, arg_name)
55
- end
62
+ if type == :req && args.length <= index && !kwargs.key?(arg_name) &&
63
+ !kwargs.key?(ALIASES[arg_name])
64
+ raise MissingRequiredArgumentError.new(method_name, arg_name)
65
+ end
56
66
 
57
- if type == :req && args.length <= index &&
58
- !kwargs.key?(arg_name) && !kwargs.key?(ALIASES[arg_name])
59
- raise MissingRequiredArgumentError.new(method_name, arg_name)
67
+ case type
68
+ when :rest
69
+ passed_args +=
70
+ if args.any?
71
+ args[index..-1]
72
+ else
73
+ kwargs[arg_name] || kwargs[ALIASES[arg_name]]
74
+ end
75
+ when :key
76
+ passed_kwargs[arg_name] = (
77
+ kwargs[arg_name] || kwargs[ALIASES[arg_name]]
78
+ )
79
+ when :req, :opt
80
+ passed_args << (
81
+ args[index] || kwargs[arg_name] || kwargs[ALIASES[arg_name]]
82
+ )
83
+ else
84
+ raise "Unknown parameter type #{type}"
85
+ end
60
86
  end
61
87
 
62
- if type == :rest && args.any?
63
- passed_params += args[index..-1]
64
- elsif type == :rest
65
- passed_params += (kwargs[arg_name] || kwargs[ALIASES[arg_name]])
66
- else
67
- passed_params <<
68
- (args[index] || kwargs[arg_name] || kwargs[ALIASES[arg_name]])
69
- end
88
+ super(*passed_args, **passed_kwargs, &block)
70
89
  end
71
-
72
- super(*passed_params, &block)
73
90
  end
74
- # rubocop:enable Metrics/MethodLength
75
- end
76
91
  end
77
92
 
78
93
  # Hook into the Minitest::Test class and prepend the Keyword module
@@ -1,39 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'lib/minitest/keyword/version'
3
+ require_relative "lib/minitest/keyword/version"
4
4
 
5
5
  version = Minitest::Keyword::VERSION
6
- repository = 'https://github.com/kddnewton/minitest-keyword'
6
+ repository = "https://github.com/kddnewton/minitest-keyword"
7
7
 
8
8
  Gem::Specification.new do |spec|
9
- spec.name = 'minitest-keyword'
10
- spec.version = version
11
- spec.authors = ['Kevin Newton']
12
- spec.email = ['kddnewton@gmail.com']
9
+ spec.name = "minitest-keyword"
10
+ spec.version = version
11
+ spec.authors = ["Kevin Newton"]
12
+ spec.email = ["kddnewton@gmail.com"]
13
13
 
14
- spec.summary = 'Use Minitest assertions with keyword arguments'
15
- spec.homepage = repository
16
- spec.license = 'MIT'
14
+ spec.summary = "Use Minitest assertions with keyword arguments"
15
+ spec.homepage = repository
16
+ spec.license = "MIT"
17
17
 
18
18
  spec.metadata = {
19
- 'bug_tracker_uri' => "#{repository}/issues",
20
- 'changelog_uri' => "#{repository}/blob/v#{version}/CHANGELOG.md",
21
- 'source_code_uri' => repository,
22
- 'rubygems_mfa_required' => 'true'
19
+ "bug_tracker_uri" => "#{repository}/issues",
20
+ "changelog_uri" => "#{repository}/blob/v#{version}/CHANGELOG.md",
21
+ "source_code_uri" => repository,
22
+ "rubygems_mfa_required" => "true"
23
23
  }
24
24
 
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
- f.match(%r{^(test|spec|features)/})
27
- end
25
+ spec.files =
26
+ `git ls-files -z`.split("\x0")
27
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
28
28
 
29
- spec.bindir = 'exe'
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ['lib']
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency 'minitest', '~> 5.0'
33
+ spec.add_dependency "minitest", "~> 5.0"
34
34
 
35
- spec.add_development_dependency 'bundler', '~> 2.0'
36
- spec.add_development_dependency 'rake', '~> 13.0'
37
- spec.add_development_dependency 'rubocop', '~> 1.12'
38
- spec.add_development_dependency 'simplecov', '~> 0.17'
35
+ spec.add_development_dependency "bundler", "~> 2.0"
36
+ spec.add_development_dependency "rake", "~> 13.0"
37
+ spec.add_development_dependency "rubocop", "~> 1.12"
38
+ spec.add_development_dependency "simplecov", "~> 0.17"
39
+ spec.add_development_dependency "syntax_tree"
39
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-keyword
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2024-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.17'
83
+ - !ruby/object:Gem::Dependency
84
+ name: syntax_tree
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description:
84
98
  email:
85
99
  - kddnewton@gmail.com
@@ -88,6 +102,7 @@ extensions: []
88
102
  extra_rdoc_files: []
89
103
  files:
90
104
  - ".github/dependabot.yml"
105
+ - ".github/workflows/auto-merge.yml"
91
106
  - ".github/workflows/main.yml"
92
107
  - ".gitignore"
93
108
  - ".rubocop.yml"
@@ -108,7 +123,7 @@ licenses:
108
123
  - MIT
109
124
  metadata:
110
125
  bug_tracker_uri: https://github.com/kddnewton/minitest-keyword/issues
111
- changelog_uri: https://github.com/kddnewton/minitest-keyword/blob/v1.0.1/CHANGELOG.md
126
+ changelog_uri: https://github.com/kddnewton/minitest-keyword/blob/v1.0.2/CHANGELOG.md
112
127
  source_code_uri: https://github.com/kddnewton/minitest-keyword
113
128
  rubygems_mfa_required: 'true'
114
129
  post_install_message:
@@ -126,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
141
  - !ruby/object:Gem::Version
127
142
  version: '0'
128
143
  requirements: []
129
- rubygems_version: 3.2.3
144
+ rubygems_version: 3.4.1
130
145
  signing_key:
131
146
  specification_version: 4
132
147
  summary: Use Minitest assertions with keyword arguments