fix build failure due to rubygem-rspec updated
This commit is contained in:
parent
cd62f4ec28
commit
620070c951
@ -0,0 +1,84 @@
|
||||
From 00bdf8d9468f88356307f0fa7bdc6c0d05925aaf Mon Sep 17 00:00:00 2001
|
||||
From: wang--ge <wang__ge@126.com>
|
||||
Date: Thu, 12 Jan 2023 15:08:14 +0800
|
||||
Subject: [PATCH] RSpec 3.11.0+ distinguish between hashes and Ruby 3 keywords
|
||||
|
||||
---
|
||||
spec/multi_json_spec.rb | 4 ++--
|
||||
spec/shared/adapter.rb | 8 ++++----
|
||||
spec/shared/json_common_adapter.rb | 4 ++--
|
||||
3 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/spec/multi_json_spec.rb b/spec/multi_json_spec.rb
|
||||
index 58bcc57..fa502ee 100644
|
||||
--- a/spec/multi_json_spec.rb
|
||||
+++ b/spec/multi_json_spec.rb
|
||||
@@ -148,8 +148,8 @@ describe MultiJson do
|
||||
end
|
||||
|
||||
it 'sets both load and dump options' do
|
||||
- expect(MultiJson).to receive(:dump_options=).with(:foo => 'bar')
|
||||
- expect(MultiJson).to receive(:load_options=).with(:foo => 'bar')
|
||||
+ expect(MultiJson).to receive(:dump_options=).with({:foo => 'bar'})
|
||||
+ expect(MultiJson).to receive(:load_options=).with({:foo => 'bar'})
|
||||
silence_warnings { MultiJson.default_options = {:foo => 'bar'} }
|
||||
end
|
||||
end
|
||||
diff --git a/spec/shared/adapter.rb b/spec/shared/adapter.rb
|
||||
index e850b99..52a6bc9 100644
|
||||
--- a/spec/shared/adapter.rb
|
||||
+++ b/spec/shared/adapter.rb
|
||||
@@ -19,7 +19,7 @@ shared_examples_for 'an adapter' do |adapter|
|
||||
before { MultiJson.dump_options = MultiJson.adapter.dump_options = {} }
|
||||
|
||||
after do
|
||||
- expect(MultiJson.adapter.instance).to receive(:dump).with(1, :foo => 'bar', :fizz => 'buzz')
|
||||
+ expect(MultiJson.adapter.instance).to receive(:dump).with(1, {:foo => 'bar', :fizz => 'buzz'})
|
||||
MultiJson.dump(1, :fizz => 'buzz')
|
||||
MultiJson.dump_options = MultiJson.adapter.dump_options = nil
|
||||
end
|
||||
@@ -100,8 +100,8 @@ shared_examples_for 'an adapter' do |adapter|
|
||||
end
|
||||
|
||||
it 'passes options to the adapter' do
|
||||
- expect(MultiJson.adapter).to receive(:dump).with('foo', :bar => :baz)
|
||||
- MultiJson.dump('foo', :bar => :baz)
|
||||
+ expect(MultiJson.adapter).to receive(:dump).with('foo', {:bar => :baz})
|
||||
+ MultiJson.dump('foo', {:bar => :baz})
|
||||
end
|
||||
|
||||
it 'dumps custom objects that implement to_json' do
|
||||
@@ -128,7 +128,7 @@ shared_examples_for 'an adapter' do |adapter|
|
||||
before { MultiJson.load_options = MultiJson.adapter.load_options = {} }
|
||||
|
||||
after do
|
||||
- expect(MultiJson.adapter.instance).to receive(:load).with('1', :foo => 'bar', :fizz => 'buzz')
|
||||
+ expect(MultiJson.adapter.instance).to receive(:load).with('1', {:foo => 'bar', :fizz => 'buzz'})
|
||||
MultiJson.load('1', :fizz => 'buzz')
|
||||
MultiJson.load_options = MultiJson.adapter.load_options = nil
|
||||
end
|
||||
diff --git a/spec/shared/json_common_adapter.rb b/spec/shared/json_common_adapter.rb
|
||||
index 9597d90..5a23c38 100644
|
||||
--- a/spec/shared/json_common_adapter.rb
|
||||
+++ b/spec/shared/json_common_adapter.rb
|
||||
@@ -15,7 +15,7 @@ shared_examples_for 'JSON-like adapter' do |adapter|
|
||||
describe 'with :indent option' do
|
||||
it 'passes it on dump' do
|
||||
object = 'foo'
|
||||
- expect(object).to receive(:to_json).with(:indent => "\t")
|
||||
+ expect(object).to receive(:to_json).with({:indent => "\t"})
|
||||
MultiJson.dump(object, :indent => "\t")
|
||||
end
|
||||
end
|
||||
@@ -23,7 +23,7 @@ shared_examples_for 'JSON-like adapter' do |adapter|
|
||||
|
||||
describe '.load' do
|
||||
it 'passes :quirks_mode option' do
|
||||
- expect(::JSON).to receive(:parse).with('[123]', :quirks_mode => false, :create_additions => false)
|
||||
+ expect(::JSON).to receive(:parse).with('[123]', {:quirks_mode => false, :create_additions => false})
|
||||
MultiJson.load('[123]', :quirks_mode => false)
|
||||
end
|
||||
end
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
Summary: A gem to provide swappable JSON backends
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 1.14.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
Group: Development/Languages
|
||||
License: MIT
|
||||
URL: https://github.com/intridea/multi_json
|
||||
@ -13,6 +13,7 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
#git archive -v -o multi_json-1.14.1-tests.tgz v1.14.1 spec/
|
||||
Source1: %{gem_name}-%{version}-tests.tgz
|
||||
Source2: https://github.com/intridea/%{gem_name}/archive/refs/tags/%{gem_name}-%{version}.tar.gz
|
||||
Source3: 0001-RSpec-3.11.0-distinguish-between-hashes-and-Ruby-3-keywords.patch
|
||||
|
||||
Requires: ruby(release)
|
||||
BuildRequires: ruby(release)
|
||||
@ -61,6 +62,8 @@ cp -a .%{gem_dir}/* \
|
||||
%check
|
||||
pushd .%{gem_instdir}
|
||||
tar xf %{SOURCE1}
|
||||
cp %{SOURCE3} .
|
||||
patch -p1 < 0001-RSpec-3.11.0-distinguish-between-hashes-and-Ruby-3-keywords.patch
|
||||
sed -i "/expect(MultiJson.adapter.to_s).to eq('MultiJson::Adapters::Oj')/ s/Oj/JsonGem/" spec/multi_json_spec.rb
|
||||
SKIP_ADAPTERS=jr_jackson rspec spec/{multi_json,options_cache}_spec.rb
|
||||
for adapter in spec/*_adapter_spec.rb; do
|
||||
@ -85,6 +88,9 @@ popd
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Jan 12 2023 Ge Wang <wangge20@h-partners.com> - 1.14.1-3
|
||||
- Distinguish between hashes and Ruby 3 keywords
|
||||
|
||||
* Mon Feb 14 2022 xu_ping <xuping33@huawei.com> - 1.14.1-2
|
||||
- Modify the tests file to correct version 1.14.1
|
||||
- Fix jr_jackson remove due to tests failed
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user