flexmock 2.4.4 → 2.4.5

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: b4a239d82da231a2f73b96aae3b7c0f5a44a28a706669970921f5035a1498eba
4
- data.tar.gz: f55c6f5594156c9665a2b4911eadee38e4d9f439e2a6ba058b63695761a1a786
3
+ metadata.gz: 95477346c9b4f5310e7aab502150273b0473194442fdee505ab366efbbba77bf
4
+ data.tar.gz: cf44602d7ddfa3197ff847e476da46adc9b82a07382c100e2eb149abc56ae285
5
5
  SHA512:
6
- metadata.gz: cd39ba9015c63eed6a00114a49c1ca207bea0454eb8263d3d6fa8a990818daeb1c8121d726f6c03a2ff6388f01944470d1897ff1214b541e5881231052ba27a8
7
- data.tar.gz: 708d7bfafb8e0a33fbb9f2b17a5adfc23c51d9c022c820af0a0c0c453b0b22809ea4634ba4a4090e7d595fab8590e5e16da155b3d2d7031d19228aca2b71cd76
6
+ metadata.gz: bc7337acd6e30ede212fbe23f44149c9b76693dacec228e06fac7b4f60bb684d9a641b2fd3b5be3b7fe401cc22bc8eeaff01883808fd594c6d7e6209f9128db5
7
+ data.tar.gz: cc11b26a6a3508adae240889c9c1e1c2484876b965f6dc82f54282061c8405bcf52d8e5b6f15a963239c9cf939cd50f9c2c74ad82bf9d469bec1a25d021c1ae8
@@ -75,12 +75,28 @@ class FlexMock
75
75
  end
76
76
  def ===(target)
77
77
  return false unless target.kind_of?(Hash)
78
- return false unless @expected.all? { |k, v| v === target[k] }
78
+ matching = @expected.all? do |k, v|
79
+ v === target[k] || v == target[k]
80
+ end
81
+ return false unless matching
79
82
 
80
83
  @expected.size == target.size
81
84
  end
82
85
  def inspect
83
- "kw(#{@expected.inspect})"
86
+ args = @expected.map do |k, v|
87
+ k_s = case k
88
+ when Symbol
89
+ "#{k}: "
90
+ else
91
+ "#{k.inspect} => "
92
+ end
93
+
94
+ v_s = FlexMock.forbid_mocking("<recursive call to mocked method in #inspect>") do
95
+ v.inspect
96
+ end
97
+ "#{k_s}#{v_s}"
98
+ end
99
+ args.join(", ")
84
100
  end
85
101
  end
86
102
 
@@ -97,6 +97,18 @@ class FlexMock
97
97
  end
98
98
  end
99
99
 
100
+ # Class method to format a list of args (the part between the
101
+ # parenthesis).
102
+ def format_kw_args(args)
103
+ if args
104
+ FlexMock.forbid_mocking("<recursive call to mocked method in #inspect>") do
105
+ args.inspect
106
+ end
107
+ else
108
+ "**args"
109
+ end
110
+ end
111
+
100
112
  # Check will assert the block returns true. If it doesn't, an
101
113
  # assertion failure is triggered with the given message.
102
114
  def check(msg, &block) # :nodoc:
@@ -65,6 +65,7 @@ class FlexMock
65
65
  def description
66
66
  result = ["should_receive(#{@sym.inspect})"]
67
67
  result << ".with(#{FlexMock.format_args(@expected_args)})" if @expected_args
68
+ result << ".with_kw_args(#{FlexMock.format_kw_args(@expected_kw_args)})" if @expected_kw_args
68
69
  @count_validators.each do |validator|
69
70
  result << validator.describe
70
71
  end
@@ -1,3 +1,3 @@
1
1
  class FlexMock
2
- VERSION = "2.4.4"
2
+ VERSION = "2.4.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-08-13 00:00:00.000000000 Z
12
+ date: 2025-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest