diff --git a/rspec-mocks-3.5.0-Address-Ruby-2.4-Fixnum-changes.patch b/rspec-mocks-3.5.0-Address-Ruby-2.4-Fixnum-changes.patch new file mode 100644 index 0000000..bcd58c9 --- /dev/null +++ b/rspec-mocks-3.5.0-Address-Ruby-2.4-Fixnum-changes.patch @@ -0,0 +1,127 @@ +From 1f7f4175e4f185d1a989dca0e8cd8bc6e6d4555f Mon Sep 17 00:00:00 2001 +From: Myron Marston +Date: Mon, 26 Dec 2016 23:26:58 -0800 +Subject: [PATCH] Address Ruby 2.4 Fixnum changes. + +--- + .../setting_constraints/matching_arguments.feature | 2 +- + spec/rspec/mocks/argument_matchers_spec.rb | 28 +++++++++++----------- + spec/rspec/mocks/matchers/receive_spec.rb | 14 +++++------ + 3 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/features/setting_constraints/matching_arguments.feature b/features/setting_constraints/matching_arguments.feature +index abc67b2..219302f 100644 +--- a/features/setting_constraints/matching_arguments.feature ++++ b/features/setting_constraints/matching_arguments.feature +@@ -17,7 +17,7 @@ Feature: Matching arguments + | A subset of a hash | `with(hash_including(:a => 1))` | `foo(:a => 1, :b => 2)` | + | An excluded subset of a hash | `with(hash_excluding(:a => 1))` | `foo(:b => 2)` | + | A subset of an array | `with(array_including(:a, :b))` | `foo([:a, :b, :c])` | +- | An instance of a specific class | `with(instance_of(Fixnum))` | `foo(3)` | ++ | An instance of a specific class | `with(instance_of(Integer))` | `foo(3)` | + | An object with a given module in its ancestors list | `with(kind_of(Numeric))` | `foo(3)` | + | Any RSpec matcher | `with()` | `foo()` | + +diff --git a/spec/rspec/mocks/argument_matchers_spec.rb b/spec/rspec/mocks/argument_matchers_spec.rb +index 3d4c154..3df9172 100644 +--- a/spec/rspec/mocks/argument_matchers_spec.rb ++++ b/spec/rspec/mocks/argument_matchers_spec.rb +@@ -59,19 +59,19 @@ module Mocks + end + + describe "instance_of" do +- it "accepts fixnum as instance_of(Fixnum)" do +- expect(a_double).to receive(:random_call).with(instance_of(Fixnum)) +- a_double.random_call(1) ++ it "accepts float as instance_of(Float)" do ++ expect(a_double).to receive(:random_call).with(instance_of(Float)) ++ a_double.random_call(1.1) + end + +- it "does NOT accept fixnum as instance_of(Numeric)" do ++ it "does NOT accept float as instance_of(Numeric)" do + expect(a_double).not_to receive(:random_call).with(instance_of(Numeric)) +- a_double.random_call(1) ++ a_double.random_call(1.1) + end + +- it "does NOT accept float as instance_of(Numeric)" do ++ it "does NOT accept integer as instance_of(Numeric)" do + expect(a_double).not_to receive(:random_call).with(instance_of(Numeric)) +- a_double.random_call(1.5) ++ a_double.random_call(1) + end + + it "rejects non numeric", :reset => true do +@@ -408,23 +408,23 @@ def ==(other) + end + + it "matches a class against itself" do +- expect(a_double).to receive(:foo).with(Fixnum) +- a_double.foo(Fixnum) ++ expect(a_double).to receive(:foo).with(Float) ++ a_double.foo(Float) + end + + it "fails a class against an unrelated class", :reset => true do +- expect(a_double).to receive(:foo).with(Fixnum) ++ expect(a_double).to receive(:foo).with(Float) + expect { a_double.foo(Hash) }.to fail + end + + it "matches a class against an instance of itself" do +- expect(a_double).to receive(:foo).with(Fixnum) +- a_double.foo(3) ++ expect(a_double).to receive(:foo).with(Float) ++ a_double.foo(3.3) + end + + it "fails a class against an object of a different type", :reset => true do +- expect(a_double).to receive(:foo).with(Fixnum) +- expect { a_double.foo(3.2) }.to fail ++ expect(a_double).to receive(:foo).with(Float) ++ expect { a_double.foo(3) }.to fail + end + + it "fails with zero arguments", :reset => true do +diff --git a/spec/rspec/mocks/matchers/receive_spec.rb b/spec/rspec/mocks/matchers/receive_spec.rb +index 4285ceb..7937e66 100644 +--- a/spec/rspec/mocks/matchers/receive_spec.rb ++++ b/spec/rspec/mocks/matchers/receive_spec.rb +@@ -47,11 +47,11 @@ module Mocks + end + + it 'allows the caller to constrain the received arguments by matcher' do +- wrapped.to receive(:foo).with an_instance_of Fixnum ++ wrapped.to receive(:foo).with an_instance_of Float + expect { +- receiver.foo(1.1) +- }.to raise_error(/expected.*\(an instance of Fixnum\)/) +- receiver.foo(1) ++ receiver.foo(1) ++ }.to raise_error(/expected.*\(an instance of Float\)/) ++ receiver.foo(1.1) + end + + it 'allows a `do...end` block implementation to be provided' do +@@ -352,9 +352,9 @@ def receiver.method_missing(*); end # a poor man's stub... + + context "when a message is not received" do + it 'sets up a message expectation that formats argument matchers correctly' do +- wrapped.to receive(:foo).with an_instance_of Fixnum ++ wrapped.to receive(:foo).with an_instance_of Float + expect { verify_all }.to( +- raise_error(/expected: 1 time with arguments: \(an instance of Fixnum\)\n\s+received: 0 times$/) ++ raise_error(/expected: 1 time with arguments: \(an instance of Float\)\n\s+received: 0 times$/) + ) + end + end +@@ -467,7 +467,7 @@ def receiver.method_missing(*); end # a poor man's stub... + let(:receiver) { klass.new } + + it 'sets up a message expectation that formats argument matchers correctly' do +- wrapped.to receive(:foo).with an_instance_of Fixnum ++ wrapped.to receive(:foo).with an_instance_of Float + expect { verify_all }.to raise_error(/should have received the following message\(s\) but didn't/) + end + end diff --git a/rubygem-rspec-mocks.spec b/rubygem-rspec-mocks.spec index d2e1371..90db549 100644 --- a/rubygem-rspec-mocks.spec +++ b/rubygem-rspec-mocks.spec @@ -3,13 +3,13 @@ %global rpmminorver .%(echo %preminorver | sed -e 's|^\\.\\.*||') %global fullver %{majorver}%{?preminorver} -%global fedorarel 1 +%global fedorarel 2 %global gem_name rspec-mocks %global need_bootstrap_set 0 -Summary: Rspec-2 doubles (mocks and stubs) +Summary: RSpec's 'test double' framework (mocks and stubs) Name: rubygem-%{gem_name} Version: %{majorver} Release: %{?preminorver:0.}%{fedorarel}%{?preminorver:%{rpmminorver}}%{?dist} @@ -21,6 +21,9 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{fullver}.gem # %%{SOURCE2} %%{name} %%{version} Source1: rubygem-%{gem_name}-%{version}-full.tar.gz Source2: rspec-related-create-full-tarball.sh +# Fix Ruby 2.4 compatibility. +# https://github.com/rspec/rspec-mocks/commit/1f7f4175e4f185d1a989dca0e8cd8bc6e6d4555f +Patch0: rspec-mocks-3.5.0-Address-Ruby-2.4-Fixnum-changes.patch #BuildRequires: ruby(release) BuildRequires: rubygems-devel @@ -51,6 +54,10 @@ gem unpack %{SOURCE0} gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec +pushd %{gem_name}-%{version} +%patch0 -p1 +popd + %build gem build %{gem_name}.gemspec %gem_install @@ -90,6 +97,9 @@ popd %{gem_docdir} %changelog +* Tue Jan 17 2017 Vít Ondruch - 3.5.0-2 +- Fix Ruby 2.4 compatibility. + * Sun Jul 24 2016 Mamoru TASAKA - 3.5.0-1 - Enable tests again