rr 3.0.7 → 3.1.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: 7690f50ed3d2cb136611f0fe21955d6b29fc8a58be9dabcb7e342034dad13b66
4
- data.tar.gz: c3ec0e439daecf5d736042cdd78e550c8e178fd3160bde8d47a1109c9552a68d
3
+ metadata.gz: 0d71cc71b67af7c0225441915cc94cdd540a8e7a5c4ac697419af1085fc4d668
4
+ data.tar.gz: 134e2e47decbf840ab066db584a0ebc35806478515844febc7e461da7f7498e7
5
5
  SHA512:
6
- metadata.gz: ccc4cab0df8cc92fd7e568ed36b392244ede5ef8ec908b01b15ac2d41eaf7d5cd3a8bb9c63f394894e43697d3baf6f326e643337b0286b3b0f02fcd38c11e2e7
7
- data.tar.gz: ec16ec1798ed218454263a8bdb3facc5b2b66270ac35aaec3ef683d64cfb58350e223274a938c970a296719c05d163041bf8627651b95268f7cf52dc956792f7
6
+ metadata.gz: 727be4c51bade728231983816ce4cbb4d95e37adbaffc09c0186c6cdee2589b1aa0fc431c14f5b64772e24a8bdc503da4e641871c3764e528c78fc7efac3845a
7
+ data.tar.gz: 0f9da75d9ca9e34d98f3bba0dd46efa4a90da791981a76d79c3addb5896da25086909afb3413ecf3af6d9889348c29e6a3c9ee6366b1b993c3081cb8cce0a9da
data/CHANGES.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.1.0 - 2022-07-14
4
+
5
+ ### Improvements
6
+
7
+ * Improved CI.
8
+ [GitHub#89](https://github.com/rr/rr/pull/89)[Patch by Peter Goldstein]
9
+ [GitHub#90](https://github.com/rr/rr/pull/90)[Patch by mishina]
10
+ [GitHub#91](https://github.com/rr/rr/pull/91)[Patch by mishina]
11
+
12
+ * Improved `wildcard_match?` against `Hash`.
13
+ [GitHub#94](https://github.com/rr/rr/issues/94)
14
+ [Reported by kawamotosatoshi]
15
+
16
+ ### Fixes
17
+
18
+ * Fixed document.
19
+ [GitHub#92](https://github.com/rr/rr/pull/92)[Patch by mishina]
20
+
21
+ ### Thanks
22
+
23
+ * Peter Goldstein
24
+
25
+ * mishina
26
+
27
+ * kawamotosatoshi
28
+
29
+ ## 3.0.9 - 2021-12-07
30
+
31
+ ### Improvements
32
+
33
+ * Marked TruffleRuby as "keyword arguments aren't fully supported yet".
34
+
35
+ ## 3.0.8 - 2021-10-17
36
+
37
+ ### Fixes
38
+
39
+ * Minitest integration: Fixed a bug that `NameError` is raised.
40
+ [GitHub#88][Reported by Matijs van Zuijlen]
41
+
42
+ ### Thanks
43
+
44
+ * Matijs van Zuijlen
45
+
3
46
  ## 3.0.7 - 2021-08-17
4
47
 
5
48
  ### Fixes
@@ -83,7 +126,7 @@
83
126
  ### Improvements
84
127
 
85
128
  * Added support for Ruby 3.0's keyword arguments.
86
- [GitHub#17][Reported by Takuro Ashie]
129
+ [GitHub#77][Reported by Takuro Ashie]
87
130
 
88
131
  ### Fixes
89
132
 
data/Gemfile CHANGED
@@ -1,3 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ case ENV["RR_INTEGRATION"]
6
+ when "minitest"
7
+ gem "minitest"
8
+ when "minitest-active-support"
9
+ gem "activesupport"
10
+ end
@@ -2,21 +2,40 @@ class Hash
2
2
  def wildcard_match?(other)
3
3
  return false unless other.is_a?(Hash)
4
4
 
5
- other_keys = other.keys
6
- return false if keys.size != other_keys.size
5
+ return false if size != other.size
7
6
 
8
- other_values = other.values
9
- each_with_index do |(key, value), i|
10
- if key.respond_to?(:wildcard_match?)
11
- return false unless key.wildcard_match?(other_keys[i])
12
- else
13
- return false unless key == other_keys[i]
14
- end
7
+ wildcards, exacts = partition {|key, _| key.respond_to?(:wildcard_match?)}
8
+ other = other.dup
9
+ exacts.each do |key, value|
10
+ return false unless other.key?(key)
11
+ other_value = other.delete(key)
15
12
  if value.respond_to?(:wildcard_match?)
16
- return false unless value.wildcard_match?(other_values[i])
13
+ return false unless value.wildcard_match?(other_value)
17
14
  else
18
- return false unless value == other_values[i]
15
+ return false unless value == other_value
19
16
  end
20
17
  end
18
+ # TODO: Add support for the following case:
19
+ # {
20
+ # is_a(Symbol) => anything,
21
+ # is_a(Symbol) => 1,
22
+ # }.wildcard_match?(d: 1, c: 3)
23
+ wildcards.each do |key, value|
24
+ found = false
25
+ other.each do |other_key, other_value|
26
+ next unless key.wildcard_match?(other_key)
27
+ if value.respond_to?(:wildcard_match?)
28
+ next unless value.wildcard_match?(other_value)
29
+ else
30
+ next unless value == other_value
31
+ end
32
+ other.delete(other_key)
33
+ found = true
34
+ break
35
+ end
36
+ return false unless found
37
+ end
38
+
39
+ true
21
40
  end
22
41
  end
@@ -41,11 +41,11 @@ module RR
41
41
 
42
42
  if defined?(::ActiveSupport::TestCase)
43
43
  is_active_support_test_case = lambda do |target|
44
- false
44
+ target.is_a?(::ActiveSupport::TestCase)
45
45
  end
46
46
  else
47
47
  is_active_support_test_case = lambda do |target|
48
- target.is_a?(::ActiveSupport::TestCase)
48
+ false
49
49
  end
50
50
  end
51
51
 
@@ -53,7 +53,7 @@ module RR
53
53
  alias_method :setup_without_rr, :setup
54
54
  define_method(:setup_with_rr) do
55
55
  setup_without_rr
56
- return is_active_support_test_case.call(self)
56
+ return if is_active_support_test_case.call(self)
57
57
  RR.reset
58
58
  RR.trim_backtrace = true
59
59
  RR.overridden_error_class = assertion_error_class
@@ -63,7 +63,7 @@ module RR
63
63
  alias_method :teardown_without_rr, :teardown
64
64
  define_method(:teardown_with_rr) do
65
65
  begin
66
- RR.verify if is_active_support_test_case.call(self)
66
+ RR.verify unless is_active_support_test_case.call(self)
67
67
  ensure
68
68
  teardown_without_rr
69
69
  end
@@ -1,7 +1,7 @@
1
1
  module RR
2
2
  module KeywordArguments
3
3
  class << self
4
- if (RUBY_VERSION <=> "3.0.0") >= 0
4
+ if (RUBY_VERSION <=> "3.0.0") >= 0 and RUBY_ENGINE != "truffleruby"
5
5
  def fully_supported?
6
6
  true
7
7
  end
data/lib/rr/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module RR
2
- VERSION = '3.0.7'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  def self.version; VERSION; end
4
4
  end
data/rr.gemspec CHANGED
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rake'
4
3
  require File.expand_path('../lib/rr/version', __FILE__)
5
4
 
6
5
  Gem::Specification.new do |gem|
@@ -13,7 +12,7 @@ Gem::Specification.new do |gem|
13
12
  gem.homepage = 'https://rr.github.io/rr'
14
13
  gem.license = 'MIT'
15
14
 
16
- gem.files = FileList[
15
+ gem.files = Dir[
17
16
  'Appraisals',
18
17
  'CHANGES.md',
19
18
  'CREDITS.md',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rr
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-08-17 00:00:00.000000000 Z
13
+ date: 2022-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -362,7 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
362
  - !ruby/object:Gem::Version
363
363
  version: '0'
364
364
  requirements: []
365
- rubygems_version: 3.3.0.dev
365
+ rubygems_version: 3.4.0.dev
366
366
  signing_key:
367
367
  specification_version: 4
368
368
  summary: RR is a test double framework that features a rich selection of double techniques