rr 3.0.5 → 3.0.9

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: 6d187dcfce0831255213627383d159a05f73412307407dc0b5a1771956780735
4
- data.tar.gz: d85e6dbbdddc435ff00927e5892f2346ac1057cb48d2f21a2788d65be976b8e6
3
+ metadata.gz: 1053e9c05c201e89415c92c0751d397aeb0cf54c122156b572f92b882ffa24a8
4
+ data.tar.gz: 197c473a885192c537f2d3eb68aa8e0efb8b3f4a88e089385cf396c7433c214e
5
5
  SHA512:
6
- metadata.gz: cc6bdb14cd6690ed0fd83da54c8165218647896e2bd505c882d2fbdfef424f069f7a67a95b481f5f382ccfde3625b87fbeb023abb70f17e8dd1788e88fb616c2
7
- data.tar.gz: 13ce13bef3e88bb683083d2680176665368f8862742f956beabf23828a92a378ecadbd6c877f7d35f9e0cff6e84e98ba71450090cc0650e827f2107f3bf1f9ea
6
+ metadata.gz: 4e90a367b42a7a0a4ef9d68296c0ffa65450b16b2bceb04347210ae15796b90857e42ae3c960a7720808e6cf3172320d985357096ec334aa42b435c98b6ef691
7
+ data.tar.gz: 856409966ac4f007b3f397c729978b8547c12f924aac17d92d30fc830f1fd6bb0266d228c772cf750aaffae20b3102deb84a7b77a37fc14cafedd2a63d2a2e64
data/CHANGES.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.9 - 2021-12-07
4
+
5
+ ### Improvements
6
+
7
+ * Marked TruffleRuby as "keyword arguments aren't fully supported yet".
8
+
9
+ ## 3.0.8 - 2021-10-17
10
+
11
+ ### Fixes
12
+
13
+ * Minitest integration: Fixed a bug that `NameError` is raised.
14
+ [GitHub#88][Reported by Matijs van Zuijlen]
15
+
16
+ ### Thanks
17
+
18
+ * Matijs van Zuijlen
19
+
20
+ ## 3.0.7 - 2021-08-17
21
+
22
+ ### Fixes
23
+
24
+ * Minitest + Active Support integration: Fixed a bug that `stub` in
25
+ `setup {...}` is ignored.
26
+ [GitHub#87][Reported by Boris]
27
+
28
+ ### Thanks
29
+
30
+ * Boris
31
+
32
+ ## 3.0.6 - 2021-08-07
33
+
34
+ ### Improvements
35
+
36
+ * `assert_received`: Added support for keyword arguments.
37
+ [GitHub#86][Reported by imadoki]
38
+
39
+ ### Thanks
40
+
41
+ * imadoki
42
+
3
43
  ## 3.0.5 - 2021-06-26
4
44
 
5
45
  ### Improvements
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
@@ -39,10 +39,21 @@ module RR
39
39
  include RR::DSL
40
40
  include Mixin
41
41
 
42
+ if defined?(::ActiveSupport::TestCase)
43
+ is_active_support_test_case = lambda do |target|
44
+ target.is_a?(::ActiveSupport::TestCase)
45
+ end
46
+ else
47
+ is_active_support_test_case = lambda do |target|
48
+ false
49
+ end
50
+ end
51
+
42
52
  unless instance_methods.any? { |method_name| method_name.to_sym == :setup_with_rr }
43
53
  alias_method :setup_without_rr, :setup
44
54
  define_method(:setup_with_rr) do
45
55
  setup_without_rr
56
+ return if is_active_support_test_case.call(self)
46
57
  RR.reset
47
58
  RR.trim_backtrace = true
48
59
  RR.overridden_error_class = assertion_error_class
@@ -52,7 +63,7 @@ module RR
52
63
  alias_method :teardown_without_rr, :teardown
53
64
  define_method(:teardown_with_rr) do
54
65
  begin
55
- RR.verify
66
+ RR.verify unless is_active_support_test_case.call(self)
56
67
  ensure
57
68
  teardown_without_rr
58
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
@@ -1,9 +1,9 @@
1
1
  module RR
2
2
  class SpyVerification
3
- def initialize(subject, method_name, args)
3
+ def initialize(subject, method_name, args, kwargs)
4
4
  @subject = subject
5
5
  @method_name = method_name.to_sym
6
- set_argument_expectation_for_args(args)
6
+ set_argument_expectation_for_args(args, kwargs)
7
7
  @ordered = false
8
8
  once
9
9
  end
@@ -44,9 +44,17 @@ module RR
44
44
  protected
45
45
  attr_writer :times_matcher
46
46
 
47
- def set_argument_expectation_for_args(args)
48
- # with_no_args and with actually set @argument_expectation
49
- args.empty? ? with_no_args : with(*args)
47
+ def set_argument_expectation_for_args(args, kwargs)
48
+ if args.empty? and kwargs.empty?
49
+ # with_no_args and with actually set @argument_expectation
50
+ with_no_args
51
+ else
52
+ if KeywordArguments.fully_supported?
53
+ with(*args, **kwargs)
54
+ else
55
+ with(*args)
56
+ end
57
+ end
50
58
  end
51
59
 
52
60
  def install_method_callback(return_value_block)
@@ -5,9 +5,16 @@ module RR
5
5
  def initialize(subject)
6
6
  @subject = subject
7
7
  end
8
-
9
- def method_missing(method_name, *args, &block)
10
- SpyVerification.new(@subject, method_name, args)
11
- end
8
+
9
+ if KeywordArguments.fully_supported?
10
+ def method_missing(method_name, *args, **kwargs, &block)
11
+ SpyVerification.new(@subject, method_name, args, kwargs)
12
+ end
13
+ else
14
+ def method_missing(method_name, *args, &block)
15
+ SpyVerification.new(@subject, method_name, args, {})
16
+ end
17
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
18
+ end
12
19
  end
13
- end
20
+ end
data/lib/rr/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module RR
2
- VERSION = '3.0.5'.freeze
2
+ VERSION = '3.0.9'.freeze
3
3
  def self.version; VERSION; end
4
4
  end
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.5
4
+ version: 3.0.9
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-06-26 00:00:00.000000000 Z
13
+ date: 2021-12-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler