[DRE-commits] [ruby-rspec-puppet] 02/03: Upstream patch to fix test errors with RSpec 3

Gaudenz Steinlin gaudenz at moszumanska.debian.org
Thu Oct 1 17:14:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

gaudenz pushed a commit to branch master
in repository ruby-rspec-puppet.

commit b034fd6c9bd1fa529508f841cf84fb0c3b7efcc6
Author: Gaudenz Steinlin <gaudenz at debian.org>
Date:   Thu Oct 1 19:02:56 2015 +0200

    Upstream patch to fix test errors with RSpec 3
---
 debian/patches/rspec3-fix.patch | 130 ++++++++++++++++++++++++++++++++++++++++
 debian/patches/series           |   1 +
 2 files changed, 131 insertions(+)

diff --git a/debian/patches/rspec3-fix.patch b/debian/patches/rspec3-fix.patch
new file mode 100644
index 0000000..dcfd8c2
--- /dev/null
+++ b/debian/patches/rspec3-fix.patch
@@ -0,0 +1,130 @@
+From e2a0bf1785ba371b48bb6e93390ac1056cdf407b Mon Sep 17 00:00:00 2001
+From: David Schmitt <david.schmitt at puppetlabs.com>
+Date: Fri, 19 Jun 2015 13:03:46 +0100
+Subject: [PATCH] run_spec: fix depreciation warnings
+
+When checking for matches, the method should only return `true` or `false.
+Fixing the tests uncovered a few situations where this was not the case.
+---
+ lib/rspec-puppet/matchers/run.rb |  5 +++--
+ spec/unit/matchers/run_spec.rb   | 24 ++++++++++++------------
+ 2 files changed, 15 insertions(+), 14 deletions(-)
+
+diff --git a/lib/rspec-puppet/matchers/run.rb b/lib/rspec-puppet/matchers/run.rb
+index 6b42b09..024bac6 100644
+--- a/lib/rspec-puppet/matchers/run.rb
++++ b/lib/rspec-puppet/matchers/run.rb
+@@ -17,6 +17,7 @@ def matches?(func_obj)
+           end
+         end
+ 
++        @has_returned = false
+         begin
+           @actual_return = @func.call
+           @has_returned = true
+@@ -32,7 +33,7 @@ def matches?(func_obj)
+             when nil
+               return true
+             when Regexp
+-              return @actual_error.message =~ @expected_error_message
++              return !!(@actual_error.message =~ @expected_error_message)
+             else
+               return @actual_error.message == @expected_error_message
+             end
+@@ -45,7 +46,7 @@ def matches?(func_obj)
+           else
+             case @expected_return
+             when Regexp
+-              return @actual_return =~ @expected_return
++              return !!(@actual_return =~ @expected_return)
+             else
+               return @actual_return == @expected_return
+             end
+diff --git a/spec/unit/matchers/run_spec.rb b/spec/unit/matchers/run_spec.rb
+index 23c3cdd..e771084 100644
+--- a/spec/unit/matchers/run_spec.rb
++++ b/spec/unit/matchers/run_spec.rb
+@@ -13,7 +13,7 @@
+   end
+ 
+   it 'should not match a lambda that raises an error' do
+-    expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be_false
++    expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be false
+   end
+ 
+   [ [], [true], [false], [''], ['string'], [nil], [0], [1.1], [[]], ['one', 'two'], [{}], [{ 'key' => 'value' }], [:undef] ].each do |supplied_params|
+@@ -31,7 +31,7 @@
+       end
+ 
+       it 'should not match a lambda that raises an error' do
+-        expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be_false
++        expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be false
+       end
+ 
+       [ true, false, '', 'string', nil, 0, 1.1, [], {}, :undef ].each do |expected_return|
+@@ -39,15 +39,15 @@
+           before(:each) { subject.and_return(expected_return) }
+ 
+           it 'should match a lambda that does return the requested value' do
+-            expect(subject.matches?(lambda { |env, *params| expected_return })).to be_true
++            expect(subject.matches?(lambda { |env, *params| expected_return })).to be true
+           end
+ 
+           it 'should not match a lambda that does return a different value' do
+-            expect(subject.matches?(lambda { |env, *params| !expected_return })).to be_false
++            expect(subject.matches?(lambda { |env, *params| !expected_return })).to be false
+           end
+ 
+           it 'should not match a lambda that raises an error' do
+-            expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be_false
++            expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be false
+           end
+         end
+       end
+@@ -56,17 +56,17 @@
+         before(:each) { subject.and_raise_error(ArgumentError) }
+ 
+         it 'should match a lambda that raises ArgumentError' do
+-          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'Forced Error' })).to be_true
++          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'Forced Error' })).to be true
+         end
+ 
+         [ true, false, '', 'string', nil, 0, 1.1, [], {}, :undef ].each do |value|
+           it "should not match a lambda that returns #{value.inspect}" do
+-            expect(subject.matches?(lambda { |env, *params| value })).to be_false
++            expect(subject.matches?(lambda { |env, *params| value })).to be false
+           end
+         end
+ 
+         it 'should not match a lambda that raises a different error' do
+-          expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be_false
++          expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be false
+         end
+       end
+ 
+@@ -74,21 +74,21 @@
+         before(:each) { subject.and_raise_error(ArgumentError, /message/) }
+ 
+         it 'should match a lambda that raises ArgumentError("with matching message")' do
+-          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'with matching message' })).to be_true
++          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'with matching message' })).to be true
+         end
+ 
+         it 'should not match a lambda that raises a different ArgumentError' do
+-          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'Forced Error' })).to be_false
++          expect(subject.matches?(lambda { |env, *params| raise ArgumentError, 'Forced Error' })).to be false
+         end
+ 
+         [ true, false, '', 'string', nil, 0, 1.1, [], {}, :undef ].each do |value|
+           it "should not match a lambda that returns #{value.inspect}" do
+-            expect(subject.matches?(lambda { |env, *params| value })).to be_false
++            expect(subject.matches?(lambda { |env, *params| value })).to be false
+           end
+         end
+ 
+         it 'should not match a lambda that raises a different error' do
+-          expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be_false
++          expect(subject.matches?(lambda { |env, *params| raise StandardError, 'Forced Error' })).to be false
+         end
+       end
+     end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..79eaf1e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+rspec3-fix.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-rspec-puppet.git



More information about the Pkg-ruby-extras-commits mailing list