rr 3.0.5 → 3.0.6

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: 6d187dcfce0831255213627383d159a05f73412307407dc0b5a1771956780735
4
- data.tar.gz: d85e6dbbdddc435ff00927e5892f2346ac1057cb48d2f21a2788d65be976b8e6
3
+ metadata.gz: 82a39c0be764a7469ef744b7d1ad4628b515e036013928623104e3876e70b01b
4
+ data.tar.gz: 78167900a5154d427ec6e0416f3ed740a79b92d3f24b85d4682acd34013b0f4d
5
5
  SHA512:
6
- metadata.gz: cc6bdb14cd6690ed0fd83da54c8165218647896e2bd505c882d2fbdfef424f069f7a67a95b481f5f382ccfde3625b87fbeb023abb70f17e8dd1788e88fb616c2
7
- data.tar.gz: 13ce13bef3e88bb683083d2680176665368f8862742f956beabf23828a92a378ecadbd6c877f7d35f9e0cff6e84e98ba71450090cc0650e827f2107f3bf1f9ea
6
+ metadata.gz: d07f274243be2338d218a19ff6ce448012875ad75f10eb9a29027b3a029b4541675d3cf92c4dd6cf5886a01abfb131ad39274a602c901f1cae9a04cf690cb0a2
7
+ data.tar.gz: febd48a6b12d689603d6f9ad9c31f97b034399b1227352b15acccd6d7b15f90496058f189c5290c0acb0510d35279656f06923f763da296cb539a5c3d682c332
data/CHANGES.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.6 - 2021-08-07
4
+
5
+ ### Improvements
6
+
7
+ * `assert_received`: Add support for keyword arguments.
8
+ [GitHub#86][Reported by imadoki]
9
+
10
+ ### Thanks
11
+
12
+ * imadoki
13
+
3
14
  ## 3.0.5 - 2021-06-26
4
15
 
5
16
  ### Improvements
@@ -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.6'.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.6
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-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler