Mamoru TASAKA wrote on 2022/02/07 22:45:
Vít Ondruch wrote on 2022/02/07 20:24:
> Dear Mamoru,
>
> Could you please check the following two packages which recently started to fail?
>
>
https://koschei.fedoraproject.org/package/rubygem-webmock?collection=f36
>
https://koschei.fedoraproject.org/package/rubygem-websocket-extensions?co...
>
> I suspect that this is related to the RSpec update, but the errors are quite strange
on the first look:
>
>
> ~~~
>
> 1) WebMock::RequestSignature initialization assigns normalized headers
> Failure/Error: @headers = WebMock::Util::Headers.normalize_headers(headers)
> #<WebMock::Util::Headers (class)> received :normalize_headers with
unexpected arguments
> expected: ({"A"=>"a"})
> got: ({"A"=>"a"})
> # ./lib/webmock/request_signature.rb:25:in `headers='
> # ./lib/webmock/request_signature.rb:49:in `assign_options'
> # ./lib/webmock/request_signature.rb:11:in `initialize'
> # ./spec/unit/request_signature_spec.rb:23:in `new'
> # ./spec/unit/request_signature_spec.rb:23:in `block (3 levels) in <top
(required)>'
> # ./lib/webmock/rspec.rb:37:in `block (2 levels) in <top
(required)>'
>
> ~~~
I am trying to fix rubygem-yard build failure, but currently I see the same issue
(on my local machine).
Looks like this is:
https://github.com/rspec/rspec-mocks/issues/1460
- was brought by:
https://github.com/rspec/rspec-mocks/pull/1394
expecially:
https://github.com/rspec/rspec-mocks/pull/1394/files#diff-ae171e2be1f799a...
> # if both arguments end with Hashes, and if one is a keyword hash and the other is
not, they don't match
So rspec upstream is saying this is correct (again keywords / hash separation...),
previous
rspec-mocks 3.10.2 behaved wrongly with ruby3 (rspec upstream says), and
rspec-mocks user side has to fix this.
Just took a look at webmock (rubygem-webmock-3.11.1-4.fc36), so with rspec-mocks 3.10.3
the following change seems needed:
============================================================================
diff -urp webmock-3.11.1/spec.orig/unit/request_signature_spec.rb
webmock-3.11.1/spec/unit/request_signature_spec.rb
--- webmock-3.11.1/spec.orig/unit/request_signature_spec.rb 2022-02-07 23:13:47.262714681
+0900
+++ webmock-3.11.1/spec/unit/request_signature_spec.rb 2022-02-07 23:23:11.527273614
+0900
@@ -18,7 +18,7 @@ describe WebMock::RequestSignature do
end
it "assigns normalized headers" do
- expect(WebMock::Util::Headers).to receive(:normalize_headers).with('A'
=> 'a').and_return('B' => 'b')
+ expect(WebMock::Util::Headers).to receive(:normalize_headers).with({'A'
=> 'a'}).and_return('B' => 'b')
expect(
WebMock::RequestSignature.new(:get, "www.example.com", headers:
{'A' => 'a'}).headers
).to eq({'B' => 'b'})
Only in webmock-3.11.1/spec/unit: request_signature_spec.rb~
diff -urp webmock-3.11.1/spec.orig/unit/response_spec.rb
webmock-3.11.1/spec/unit/response_spec.rb
--- webmock-3.11.1/spec.orig/unit/response_spec.rb 2022-02-07 23:13:47.262714681 +0900
+++ webmock-3.11.1/spec/unit/response_spec.rb 2022-02-07 23:23:52.502314196 +0900
@@ -31,7 +31,7 @@ describe WebMock::Response do
end
it "should report normalized headers" do
- expect(WebMock::Util::Headers).to receive(:normalize_headers).with('A' =>
'a').and_return('B' => 'b')
+ expect(WebMock::Util::Headers).to receive(:normalize_headers).with({'A' =>
'a'}).and_return('B' => 'b')
@response = WebMock::Response.new(headers: {'A' => 'a'})
expect((a)response.headers).to eq({'B' => 'b'})
end
============================================================================
Mamoru