From 49c96a6415cc241b02356d28b7a5a89d0e134bfa Mon Sep 17 00:00:00 2001
From: Nicolas Rodriguez <nico@nicoladmin.fr>
Date: Mon, 4 Jul 2022 01:07:36 +0200
Subject: [PATCH] Fix broken tests with Ruby 3.x
---
spec/unit/request_spec.rb | 4 ++--
spec/unit/resource_spec.rb | 14 +++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/spec/unit/request_spec.rb b/spec/unit/request_spec.rb
index 54e635b0..07b4a985 100644
--- a/spec/unit/request_spec.rb
+++ b/spec/unit/request_spec.rb
@@ -505,9 +505,9 @@
it "class method execute wraps constructor" do
req = double("rest request")
- expect(RestClient::Request).to receive(:new).with(1 => 2).and_return(req)
+ expect(RestClient::Request).to receive(:new).with({1 => 2}).and_return(req)
expect(req).to receive(:execute)
- RestClient::Request.execute(1 => 2)
+ RestClient::Request.execute({1 => 2})
end
describe "exception" do
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 676e95d5..ce0427e1 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -7,37 +7,37 @@
context "Resource delegation" do
it "GET" do
- expect(RestClient::Request).to receive(:execute).with(:method => :get, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :get, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.get
end
it "HEAD" do
- expect(RestClient::Request).to receive(:execute).with(:method => :head, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :head, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.head
end
it "POST" do
- expect(RestClient::Request).to receive(:execute).with(:method => :post, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :post, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.post 'abc', :content_type => 'image/jpg'
end
it "PUT" do
- expect(RestClient::Request).to receive(:execute).with(:method => :put, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :put, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.put 'abc', :content_type => 'image/jpg'
end
it "PATCH" do
- expect(RestClient::Request).to receive(:execute).with(:method => :patch, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :patch, :url => 'http://some/resource', :payload => 'abc', :headers => {:content_type => 'image/jpg', 'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.patch 'abc', :content_type => 'image/jpg'
end
it "DELETE" do
- expect(RestClient::Request).to receive(:execute).with(:method => :delete, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :delete, :url => 'http://some/resource', :headers => {'X-Something' => '1'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.delete
end
it "overrides resource headers" do
- expect(RestClient::Request).to receive(:execute).with(:method => :get, :url => 'http://some/resource', :headers => {'X-Something' => '2'}, :user => 'jane', :password => 'mypass', :log => nil)
+ expect(RestClient::Request).to receive(:execute).with({ :method => :get, :url => 'http://some/resource', :headers => {'X-Something' => '2'}, :user => 'jane', :password => 'mypass', :log => nil })
@resource.get 'X-Something' => '2'
end
end