[DRE-commits] [ruby-spy] 03/06: add a few patches for tests

Cédric Boutillier boutil at moszumanska.debian.org
Thu Jul 23 04:16:28 UTC 2015


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

boutil pushed a commit to branch master
in repository ruby-spy.

commit 4bd3e8d74f23c7f09597d9279c1fa4f24dfbe65b
Author: Cédric Boutillier <boutil at debian.org>
Date:   Thu Jul 23 05:49:48 2015 +0200

    add a few patches for tests
    
     * only apply clean_test_helper.patch
     * only run tests under test/
     * running specs is on the TODO list
---
 debian/TODO                              |   5 +
 debian/patches/clean_test_helper.patch   |  27 ++
 debian/patches/only_default_yamler.patch |  68 +++
 debian/patches/rspec3.patch              | 750 +++++++++++++++++++++++++++++++
 debian/patches/series                    |   1 +
 debian/ruby-tests.rake                   |  16 +-
 6 files changed, 863 insertions(+), 4 deletions(-)

diff --git a/debian/TODO b/debian/TODO
new file mode 100644
index 0000000..a4b9bd0
--- /dev/null
+++ b/debian/TODO
@@ -0,0 +1,5 @@
+* run the tests under spec/
+
+  -- Cédric Boutillier <boutil at debian.org>  Thu, 23 Jul 2015 05:44:52 +0200
+
+
diff --git a/debian/patches/clean_test_helper.patch b/debian/patches/clean_test_helper.patch
new file mode 100644
index 0000000..eefcf34
--- /dev/null
+++ b/debian/patches/clean_test_helper.patch
@@ -0,0 +1,27 @@
+Description: remove extra stuff from spec_helper and test_helper
+Author: Cédric Boutillier <boutil at debian.org>
+Forwarded: not-needed
+Last-Update: 2015-07-23
+
+--- a/test/test_helper.rb
++++ b/test/test_helper.rb
+@@ -1,9 +1,5 @@
+-require 'bundler/setup'
+ require 'minitest/autorun'
+ require 'pry'
+-require 'pry-nav'
+-require 'coveralls'
+-Coveralls.wear!
+ 
+ require 'spy'
+ 
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -3,7 +3,6 @@
+ require "rspec/expectations"
+ require "spy"
+ require "pry"
+-require "pry-nav"
+ 
+ RSpec::Matchers.define :include_method do |expected|
+   match do |actual|
diff --git a/debian/patches/only_default_yamler.patch b/debian/patches/only_default_yamler.patch
new file mode 100644
index 0000000..74c3c9d
--- /dev/null
+++ b/debian/patches/only_default_yamler.patch
@@ -0,0 +1,68 @@
+Description: <short summary of the patch>
+ TODO: Put a short summary on the line above and replace this paragraph
+ with a longer explanation of this change. Complete the meta-information
+ with other relevant fields (see below for details). To make it easier, the
+ information below has been extracted from the changelog. Adjust it or drop
+ it.
+ .
+ ruby-spy (0.4.2-1) UNRELEASED; urgency=medium
+ .
+   * Initial release (Closes: #nnnn)
+Author: Cédric Boutillier <boutil at debian.org>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- ruby-spy-0.4.2.orig/spec/spy/serialization_spec.rb
++++ ruby-spy-0.4.2/spec/spy/serialization_spec.rb
+@@ -1,7 +1,7 @@
+ require 'spec_helper'
+ require 'yaml'
+ require 'psych'
+-require 'syck'
++#require 'syck'
+ 
+ module Spy
+   describe "serialization" do
+@@ -77,19 +77,19 @@ module Spy
+                               false
+                             end
+ 
+-      if compiled_with_psych
+-        context 'using Syck as the YAML engine' do
+-          before(:each) { ::YAML::ENGINE.yamler = 'syck' }
+-          it_behaves_like 'normal YAML serialization'
+-        end
+-
+-        context 'using Psych as the YAML engine' do
+-          before(:each) { ::YAML::ENGINE.yamler = 'psych' }
+-          it_behaves_like 'normal YAML serialization'
+-        end
+-      else
++      #if compiled_with_psych
++      #  context 'using Syck as the YAML engine' do
++      #    before(:each) { ::YAML::ENGINE.yamler = 'syck' }
++      #    it_behaves_like 'normal YAML serialization'
++      #  end
++
++      #  context 'using Psych as the YAML engine' do
++      #    before(:each) { ::YAML::ENGINE.yamler = 'psych' }
++      #    it_behaves_like 'normal YAML serialization'
++      #  end
++      #else
+         it_behaves_like 'normal YAML serialization'
+-      end
++      #end
+     end
+ 
+     without_yaml_loaded do
diff --git a/debian/patches/rspec3.patch b/debian/patches/rspec3.patch
new file mode 100644
index 0000000..763d7a5
--- /dev/null
+++ b/debian/patches/rspec3.patch
@@ -0,0 +1,750 @@
+Description: Convert specs to RSpec 3.3.2 syntax with Transpec
+* 29 conversions
+    from: obj.should_receive(:message)
+      to: expect(obj).to receive(:message)
+
+* 24 conversions
+    from: Klass.any_instance.should_receive(:message)
+      to: expect_any_instance_of(Klass).to receive(:message)
+
+* 19 conversions
+    from: be_false
+      to: be_falsey
+
+* 8 conversions
+    from: Klass.any_instance.stub(:message)
+      to: allow_any_instance_of(Klass).to receive(:message)
+
+* 7 conversions
+    from: be_true
+      to: be_truthy
+
+* 5 conversions
+    from: obj.should_not_receive(:message)
+      to: expect(obj).not_to receive(:message)
+
+* 4 conversions
+    from: Klass.any_instance.unstub(:message)
+      to: allow_any_instance_of(Klass).to receive(:message).and_call_original
+
+* 2 conversions
+    from: expect { }.not_to raise_error(SpecificErrorClass)
+      to: expect { }.not_to raise_error
+
+* 1 conversion
+    from: expect(collection).to have_at_least(n).items
+      to: expect(collection.size).to be >= n
+
+* 1 conversion
+    from: expect(collection).to have_at_most(n).items
+      to: expect(collection.size).to be <= n
+
+* 1 conversion
+    from: stub('something')
+      to: double('something')
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -12,13 +11,13 @@
+ end
+ 
+ RSpec.configure do |config|
+-  config.color_enabled = true
++  config.color = true
+   config.order = :random
+   config.run_all_when_everything_filtered = true
+   config.treat_symbols_as_metadata_keys_with_true_values = true
+   config.filter_run_including :focus
+   config.filter_run_excluding :broken => true
+-  config.mock_with :absolutely_nothing
++  config.mock_with :nothing
+ 
+   config.expect_with :rspec do |expectations|
+     expectations.syntax = :expect
+--- a/spec/spy/any_instance_spec.rb
++++ b/spec/spy/any_instance_spec.rb
+@@ -97,38 +97,38 @@
+ 
+       context "core ruby objects" do
+         it "works uniformly across *everything*" do
+-          Object.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(Object).to receive(:foo).and_return(1)
+           expect(Object.new.foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor []" do
+-          Array.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(Array).to receive(:foo).and_return(1)
+           expect([].foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor {}" do
+-          Hash.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(Hash).to receive(:foo).and_return(1)
+           expect({}.foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor \"\"" do
+-          String.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(String).to receive(:foo).and_return(1)
+           expect("".foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor \'\'" do
+-          String.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(String).to receive(:foo).and_return(1)
+           expect(''.foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor module" do
+-          Module.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(Module).to receive(:foo).and_return(1)
+           module RSpec::SampleRspecTestModule;end
+           expect(RSpec::SampleRspecTestModule.foo).to eq(1)
+         end
+ 
+         it "works with the non-standard constructor class" do
+-          Class.any_instance.stub(:foo).and_return(1)
++          allow_any_instance_of(Class).to receive(:foo).and_return(1)
+           class RSpec::SampleRspecTestClass;end
+           expect(RSpec::SampleRspecTestClass.foo).to eq(1)
+         end
+@@ -138,28 +138,28 @@
+     context "unstub implementation" do
+       it "replaces the stubbed method with the original method" do
+         Spy.on_instance_method(klass, :existing_method)
+-        klass.any_instance.unstub(:existing_method)
++        allow_any_instance_of(klass).to receive(:existing_method).and_call_original
+         expect(klass.new.existing_method).to eq(:existing_method_return_value)
+       end
+ 
+       it "removes all stubs with the supplied method name" do
+         Spy.on_instance_method(klass, :existing_method).with(1)
+         Spy.on_instance_method(klass, :existing_method).with(2)
+-        klass.any_instance.unstub(:existing_method)
++        allow_any_instance_of(klass).to receive(:existing_method).and_call_original
+         expect(klass.new.existing_method).to eq(:existing_method_return_value)
+       end
+ 
+       it "does not remove any expectations with the same method name" do
+-        klass.any_instance.should_receive(:existing_method_with_arguments).with(3).and_return(:three)
++        expect_any_instance_of(klass).to receive(:existing_method_with_arguments).with(3).and_return(:three)
+         Spy.on_instance_method(klass, :existing_method_with_arguments).with(1)
+         Spy.on_instance_method(klass, :existing_method_with_arguments).with(2)
+-        klass.any_instance.unstub(:existing_method_with_arguments)
++        allow_any_instance_of(klass).to receive(:existing_method_with_arguments).and_call_original
+         expect(klass.new.existing_method_with_arguments(3)).to eq(:three)
+       end
+ 
+       it "raises a MockExpectationError if the method has not been stubbed" do
+         expect {
+-          klass.any_instance.unstub(:existing_method)
++          allow_any_instance_of(klass).to receive(:existing_method).and_call_original
+         }.to raise_error(RSpec::Mocks::MockExpectationError, 'The method `existing_method` was not stubbed or was already unstubbed')
+       end
+     end
+@@ -170,13 +170,13 @@
+ 
+       context "with an expectation is set on a method which does not exist" do
+         it "returns the expected value" do
+-          klass.any_instance.should_receive(:foo).and_return(1)
++          expect_any_instance_of(klass).to receive(:foo).and_return(1)
+           expect(klass.new.foo(1)).to eq(1)
+         end
+ 
+         it "fails if an instance is created but no invocation occurs" do
+           expect do
+-            klass.any_instance.should_receive(:foo)
++            expect_any_instance_of(klass).to receive(:foo)
+             klass.new
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+@@ -184,31 +184,31 @@
+ 
+         it "fails if no instance is created" do
+           expect do
+-            klass.any_instance.should_receive(:foo).and_return(1)
++            expect_any_instance_of(klass).to receive(:foo).and_return(1)
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+         end
+ 
+         it "fails if no instance is created and there are multiple expectations" do
+           expect do
+-            klass.any_instance.should_receive(:foo)
+-            klass.any_instance.should_receive(:bar)
++            expect_any_instance_of(klass).to receive(:foo)
++            expect_any_instance_of(klass).to receive(:bar)
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: bar, foo')
+         end
+ 
+         it "allows expectations on instances to take priority" do
+-          klass.any_instance.should_receive(:foo)
++          expect_any_instance_of(klass).to receive(:foo)
+           klass.new.foo
+ 
+           instance = klass.new
+-          instance.should_receive(:foo).and_return(result = Object.new)
++          expect(instance).to receive(:foo).and_return(result = Object.new)
+           expect(instance.foo).to eq(result)
+         end
+ 
+         context "behaves as 'exactly one instance'" do
+           it "passes if subsequent invocations do not receive that message" do
+-            klass.any_instance.should_receive(:foo)
++            expect_any_instance_of(klass).to receive(:foo)
+             klass.new.foo
+             klass.new
+           end
+@@ -217,7 +217,7 @@
+             instance_one = klass.new
+             instance_two = klass.new
+             expect do
+-              klass.any_instance.should_receive(:foo)
++              expect_any_instance_of(klass).to receive(:foo)
+ 
+               instance_one.foo
+               instance_two.foo
+@@ -228,8 +228,8 @@
+         context "normal expectations on the class object" do
+           it "fail when unfulfilled" do
+             expect do
+-              klass.any_instance.should_receive(:foo)
+-              klass.should_receive(:woot)
++              expect_any_instance_of(klass).to receive(:foo)
++              expect(klass).to receive(:woot)
+               klass.new.foo
+               klass.rspec_verify
+             end.to(raise_error(RSpec::Mocks::MockExpectationError) do |error|
+@@ -239,8 +239,8 @@
+ 
+ 
+           it "pass when expectations are met" do
+-            klass.any_instance.should_receive(:foo)
+-            klass.should_receive(:woot).and_return(result = Object.new)
++            expect_any_instance_of(klass).to receive(:foo)
++            expect(klass).to receive(:woot).and_return(result = Object.new)
+             klass.new.foo
+             expect(klass.woot).to eq(result)
+           end
+@@ -249,13 +249,13 @@
+ 
+       context "with an expectation is set on a method that exists" do
+         it "returns the expected value" do
+-          klass.any_instance.should_receive(:existing_method).and_return(1)
++          expect_any_instance_of(klass).to receive(:existing_method).and_return(1)
+           expect(klass.new.existing_method(1)).to eq(1)
+         end
+ 
+         it "fails if an instance is created but no invocation occurs" do
+           expect do
+-            klass.any_instance.should_receive(:existing_method)
++            expect_any_instance_of(klass).to receive(:existing_method)
+             klass.new
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+@@ -263,22 +263,22 @@
+ 
+         it "fails if no instance is created" do
+           expect do
+-            klass.any_instance.should_receive(:existing_method)
++            expect_any_instance_of(klass).to receive(:existing_method)
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+         end
+ 
+         it "fails if no instance is created and there are multiple expectations" do
+           expect do
+-            klass.any_instance.should_receive(:existing_method)
+-            klass.any_instance.should_receive(:another_existing_method)
++            expect_any_instance_of(klass).to receive(:existing_method)
++            expect_any_instance_of(klass).to receive(:another_existing_method)
+             klass.rspec_verify
+           end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: another_existing_method, existing_method')
+         end
+ 
+         context "after any one instance has received a message" do
+           it "passes if subsequent invocations do not receive that message" do
+-            klass.any_instance.should_receive(:existing_method)
++            expect_any_instance_of(klass).to receive(:existing_method)
+             klass.new.existing_method
+             klass.new
+           end
+@@ -287,7 +287,7 @@
+             instance_one = klass.new
+             instance_two = klass.new
+             expect do
+-              klass.any_instance.should_receive(:existing_method)
++              expect_any_instance_of(klass).to receive(:existing_method)
+ 
+               instance_one.existing_method
+               instance_two.existing_method
+@@ -309,13 +309,13 @@
+           context "public methods" do
+             before(:each) do
+               Spy.on_instance_method(klass, :existing_method).and_return(1)
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_true
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_truthy
+             end
+ 
+             it "restores the class to its original state after each example when no instance is created" do
+               space.verify_all
+ 
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_falsey
+               expect(klass.new.existing_method).to eq(existing_method_return_value)
+             end
+ 
+@@ -324,7 +324,7 @@
+ 
+               space.verify_all
+ 
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_falsey
+               expect(klass.new.existing_method).to eq(existing_method_return_value)
+             end
+ 
+@@ -334,7 +334,7 @@
+ 
+               space.verify_all
+ 
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_falsey
+               expect(klass.new.existing_method).to eq(existing_method_return_value)
+             end
+           end
+@@ -346,11 +346,11 @@
+             end
+ 
+             it "cleans up the backed up method" do
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_falsey
+             end
+ 
+             it "restores a stubbed private method after the spec is run" do
+-              expect(klass.private_method_defined?(:private_method)).to be_true
++              expect(klass.private_method_defined?(:private_method)).to be_truthy
+             end
+ 
+             it "ensures that the restored method behaves as it originally did" do
+@@ -362,17 +362,17 @@
+         context "with expectations" do
+           context "private methods" do
+             before :each do
+-              klass.any_instance.should_receive(:private_method).and_return(:something)
++              expect_any_instance_of(klass).to receive(:private_method).and_return(:something)
+               klass.new.private_method
+               space.verify_all
+             end
+ 
+             it "cleans up the backed up method" do
+-              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
++              expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_falsey
+             end
+ 
+             it "restores a stubbed private method after the spec is run" do
+-              expect(klass.private_method_defined?(:private_method)).to be_true
++              expect(klass.private_method_defined?(:private_method)).to be_truthy
+             end
+ 
+             it "ensures that the restored method behaves as it originally did" do
+@@ -383,7 +383,7 @@
+           context "ensures that the subsequent specs do not see expectations set in previous specs" do
+             context "when the instance created after the expectation is set" do
+               it "first spec" do
+-                klass.any_instance.should_receive(:existing_method).and_return(Object.new)
++                expect_any_instance_of(klass).to receive(:existing_method).and_return(Object.new)
+                 klass.new.existing_method
+               end
+ 
+@@ -398,7 +398,7 @@
+               end
+ 
+               it "first spec" do
+-                klass.any_instance.should_receive(:existing_method).and_return(Object.new)
++                expect_any_instance_of(klass).to receive(:existing_method).and_return(Object.new)
+                 @instance.existing_method
+               end
+ 
+@@ -409,7 +409,7 @@
+           end
+ 
+           it "ensures that the next spec does not see that expectation" do
+-            klass.any_instance.should_receive(:existing_method).and_return(Object.new)
++            expect_any_instance_of(klass).to receive(:existing_method).and_return(Object.new)
+             klass.new.existing_method
+             space.verify_all
+ 
+@@ -447,7 +447,7 @@
+         Spy::Subroutine.new(Object, :some_method, false).hook(force: true)
+         o = Object.new
+         o.some_method
+-        expect { o.dup.some_method }.to_not raise_error(SystemStackError)
++        expect { o.dup.some_method }.to_not raise_error
+       end
+ 
+       it "doesn't bomb if the object doesn't support `dup`" do
+@@ -465,7 +465,7 @@
+ 
+         Spy::Subroutine.new(Object, :some_method, false).hook(force: true)
+ 
+-        expect { klass.new.dup('Dup dup dup') }.to_not raise_error(ArgumentError)
++        expect { klass.new.dup('Dup dup dup') }.to_not raise_error
+       end
+     end
+ 
+@@ -481,7 +481,7 @@
+         instance_one = sub_klass.new
+         instance_two = sub_klass.new
+         expect do
+-          klass.any_instance.should_receive(:existing_method)
++          expect_any_instance_of(klass).to receive(:existing_method)
+           instance_one.existing_method
+           instance_two.existing_method
+         end.to raise_error(RSpec::Mocks::MockExpectationError, "The message 'existing_method' was received by #{instance_two.inspect} but has already been received by #{instance_one.inspect}")
+@@ -492,12 +492,12 @@
+       let(:http_request_class) { Struct.new(:method, :uri) }
+ 
+       it "stubs the method correctly" do
+-        http_request_class.any_instance.stub(:existing_method).and_return("foo")
++        allow_any_instance_of(http_request_class).to receive(:existing_method).and_return("foo")
+         expect(http_request_class.new.existing_method).to eq "foo"
+       end
+ 
+       it "mocks the method correctly" do
+-        http_request_class.any_instance.should_receive(:existing_method).and_return("foo")
++        expect_any_instance_of(http_request_class).to receive(:existing_method).and_return("foo")
+         expect(http_request_class.new.existing_method).to eq "foo"
+       end
+     end
+--- a/spec/spy/mutate_const_spec.rb
++++ b/spec/spy/mutate_const_spec.rb
+@@ -87,18 +87,18 @@
+ 
+     shared_examples_for "loaded constant hiding" do |const_name|
+       before do
+-        expect(recursive_const_defined?(const_name)).to be_true
++        expect(recursive_const_defined?(const_name)).to be_truthy
+       end
+ 
+       it 'allows it to be hidden' do
+         hide_const(const_name)
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'resets the constant when rspec clear its mocks' do
+         hide_const(const_name)
+         reset_rspec_mocks
+-        expect(recursive_const_defined?(const_name)).to be_true
++        expect(recursive_const_defined?(const_name)).to be_truthy
+       end
+ 
+       it 'returns nil' do
+@@ -110,7 +110,7 @@
+       include_context "constant example methods", const_name
+ 
+       before do
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'allows it to be stubbed' do
+@@ -121,7 +121,7 @@
+       it 'removes the constant when rspec clears its mocks' do
+         stub_const(const_name, 7)
+         reset_rspec_mocks
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'returns the stubbed value' do
+@@ -139,18 +139,18 @@
+       include_context "constant example methods", const_name
+ 
+       before do
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'allows it to be hidden, though the operation has no effect' do
+         hide_const(const_name)
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'remains undefined after rspec clears its mocks' do
+         hide_const(const_name)
+         reset_rspec_mocks
+-        expect(recursive_const_defined?(const_name)).to be_false
++        expect(recursive_const_defined?(const_name)).to be_falsey
+       end
+ 
+       it 'returns nil' do
+@@ -202,7 +202,7 @@
+         orig_value = TOP_LEVEL_VALUE_CONST
+ 
+         hide_const("TOP_LEVEL_VALUE_CONST")
+-        expect(recursive_const_defined?("TOP_LEVEL_VALUE_CONST")).to be_false
++        expect(recursive_const_defined?("TOP_LEVEL_VALUE_CONST")).to be_falsey
+ 
+         stub_const("TOP_LEVEL_VALUE_CONST", 12345)
+         expect(TOP_LEVEL_VALUE_CONST).to eq 12345
+@@ -239,8 +239,8 @@
+           stub = Module.new
+           stub_const("TestSubClass", stub, :transfer_nested_constants => true)
+           expect(stub::P).to eq(:p)
+-          expect(defined?(stub::M)).to be_false
+-          expect(defined?(stub::N)).to be_false
++          expect(defined?(stub::M)).to be_falsey
++          expect(defined?(stub::N)).to be_falsey
+         end
+ 
+         it 'raises an error when asked to transfer a nested inherited constant' do
+@@ -258,7 +258,7 @@
+           stub_const("TestClass", stub, :transfer_nested_constants => [:M, :N])
+           expect(stub::M).to eq(:m)
+           expect(stub::N).to eq(:n)
+-          expect(defined?(stub::Nested)).to be_false
++          expect(defined?(stub::Nested)).to be_falsey
+         end
+ 
+         it 'raises an error if asked to transfer nested constants but given an object that does not support them' do
+@@ -326,11 +326,11 @@
+ 
+         it 'removes the unloaded constant but leaves the loaded constant when rspec resets its mocks' do
+           expect(defined?(TestClass)).to be_true
+-          expect(defined?(TestClass::X)).to be_false
++          expect(defined?(TestClass::X)).to be_falsey
+           stub_const("TestClass::X", 7)
+           reset_rspec_mocks
+-          expect(defined?(TestClass)).to be_true
+-          expect(defined?(TestClass::X)).to be_false
++          expect(defined?(TestClass)).to be_truthy
++          expect(defined?(TestClass::X)).to be_falsey
+         end
+ 
+         it 'raises a helpful error if it cannot be stubbed due to an intermediary constant that is not a module' do
+@@ -344,11 +344,11 @@
+ 
+         it 'removes the first unloaded constant but leaves the loaded nested constant when rspec resets its mocks' do
+           expect(defined?(TestClass::Nested::NestedEvenMore)).to be_true
+-          expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_false
++          expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_falsey
+           stub_const("TestClass::Nested::NestedEvenMore::X::Y::Z", 7)
+           reset_rspec_mocks
+-          expect(defined?(TestClass::Nested::NestedEvenMore)).to be_true
+-          expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_false
++          expect(defined?(TestClass::Nested::NestedEvenMore)).to be_truthy
++          expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_falsey
+         end
+       end
+     end
+--- a/spec/spy/nil_expectation_warning_spec.rb
++++ b/spec/spy/nil_expectation_warning_spec.rb
+@@ -14,24 +14,24 @@
+     describe "an expectation set on nil" do
+       it "issues a warning with file and line number information" do
+         expected_warning = %r%An expectation of :foo was set on nil. Called from #{__FILE__}:#{__LINE__+3}(:in .+)?. Use allow_message_expectations_on_nil to disable warnings.%
+-        Kernel.should_receive(:warn).with(expected_warning)
++        expect(Kernel).to receive(:warn).with(expected_warning)
+ 
+-        nil.should_receive(:foo)
++        expect(nil).to receive(:foo)
+         nil.foo
+       end
+ 
+       it "issues a warning when the expectation is negative" do
+-        Kernel.should_receive(:warn)
++        expect(Kernel).to receive(:warn)
+ 
+-        nil.should_not_receive(:foo)
++        expect(nil).not_to receive(:foo)
+       end
+ 
+       it "does not issue a warning when expectations are set to be allowed" do
+         allow_message_expectations_on_nil
+-        Kernel.should_not_receive(:warn)
++        expect(Kernel).not_to receive(:warn)
+ 
+-        nil.should_receive(:foo)
+-        nil.should_not_receive(:bar)
++        expect(nil).to receive(:foo)
++        expect(nil).not_to receive(:bar)
+         nil.foo
+       end
+     end
+@@ -43,8 +43,8 @@
+                         allow_message_expectations_on_nil
+                       end
+         example_group.it("should not effect the next exapmle ran") do
+-                        Kernel.should_receive(:warn)
+-                        nil.should_receive(:foo)
++                        expect(Kernel).to receive(:warn)
++                        expect(nil).to receive(:foo)
+                         nil.foo
+                       end
+ 
+--- a/spec/spy/partial_mock_spec.rb
++++ b/spec/spy/partial_mock_spec.rb
+@@ -30,7 +30,7 @@
+       allow_message_expectations_on_nil
+ 
+       _nil = nil
+-      spy = stub(_nil, :foobar)
++      spy = double(_nil, :foobar)
+       _nil.foobar
+       expect(spy).to have_been_called
+     end
+--- a/spec/spy/passing_argument_matchers_spec.rb
++++ b/spec/spy/passing_argument_matchers_spec.rb
+@@ -13,82 +13,82 @@
+ 
+     context "handling argument matchers" do
+       it "accepts true as boolean()" do
+-        @double.should_receive(:random_call).with(boolean())
++        expect(@double).to receive(:random_call).with(boolean())
+         @double.random_call(true)
+       end
+ 
+       it "accepts false as boolean()" do
+-        @double.should_receive(:random_call).with(boolean())
++        expect(@double).to receive(:random_call).with(boolean())
+         @double.random_call(false)
+       end
+ 
+       it "accepts fixnum as kind_of(Numeric)" do
+-        @double.should_receive(:random_call).with(kind_of(Numeric))
++        expect(@double).to receive(:random_call).with(kind_of(Numeric))
+         @double.random_call(1)
+       end
+ 
+       it "accepts float as an_instance_of(Numeric)" do
+-        @double.should_receive(:random_call).with(kind_of(Numeric))
++        expect(@double).to receive(:random_call).with(kind_of(Numeric))
+         @double.random_call(1.5)
+       end
+ 
+       it "accepts fixnum as instance_of(Fixnum)" do
+-        @double.should_receive(:random_call).with(instance_of(Fixnum))
++        expect(@double).to receive(:random_call).with(instance_of(Fixnum))
+         @double.random_call(1)
+       end
+ 
+       it "does NOT accept fixnum as instance_of(Numeric)" do
+-        @double.should_not_receive(:random_call).with(instance_of(Numeric))
++        expect(@double).not_to receive(:random_call).with(instance_of(Numeric))
+         @double.random_call(1)
+       end
+ 
+       it "does NOT accept float as instance_of(Numeric)" do
+-        @double.should_not_receive(:random_call).with(instance_of(Numeric))
++        expect(@double).not_to receive(:random_call).with(instance_of(Numeric))
+         @double.random_call(1.5)
+       end
+ 
+       it "accepts string as anything()" do
+-        @double.should_receive(:random_call).with("a", anything(), "c")
++        expect(@double).to receive(:random_call).with("a", anything(), "c")
+         @double.random_call("a", "whatever", "c")
+       end
+ 
+       it "matches duck type with one method" do
+-        @double.should_receive(:random_call).with(duck_type(:length))
++        expect(@double).to receive(:random_call).with(duck_type(:length))
+         @double.random_call([])
+       end
+ 
+       it "matches duck type with two methods" do
+-        @double.should_receive(:random_call).with(duck_type(:abs, :div))
++        expect(@double).to receive(:random_call).with(duck_type(:abs, :div))
+         @double.random_call(1)
+       end
+ 
+       it "matches no args against any_args()" do
+-        @double.should_receive(:random_call).with(any_args)
++        expect(@double).to receive(:random_call).with(any_args)
+         @double.random_call()
+       end
+ 
+       it "matches one arg against any_args()" do
+-        @double.should_receive(:random_call).with(any_args)
++        expect(@double).to receive(:random_call).with(any_args)
+         @double.random_call("a string")
+       end
+ 
+       it "matches no args against no_args()" do
+-        @double.should_receive(:random_call).with(no_args)
++        expect(@double).to receive(:random_call).with(no_args)
+         @double.random_call()
+       end
+ 
+       it "matches hash with hash_including same hash" do
+-        @double.should_receive(:random_call).with(hash_including(:a => 1))
++        expect(@double).to receive(:random_call).with(hash_including(:a => 1))
+         @double.random_call(:a => 1)
+       end
+     end
+ 
+     context "handling block matchers" do
+       it "matches arguments against RSpec expectations" do
+-        @double.should_receive(:random_call).with {|arg1, arg2, arr, *rest|
++        expect(@double).to receive(:random_call).with {|arg1, arg2, arr, *rest|
+           expect(arg1).to eq 5
+-          expect(arg2).to have_at_least(3).characters
+-          expect(arg2).to have_at_most(10).characters
++          expect(arg2.size).to be >= 3
++          expect(arg2.size).to be <= 10
+           expect(arr.map {|i| i * 2}).to eq [2,4,6]
+           expect(rest).to eq [:fee, "fi", 4]
+         }
+@@ -97,7 +97,7 @@
+ 
+       it "does not eval the block as the return value" do
+         eval_count = 0
+-        @double.should_receive(:msg).with {|a| eval_count += 1}
++        expect(@double).to receive(:msg).with {|a| eval_count += 1}
+         @double.msg(:ignore)
+         expect(eval_count).to eq(1)
+       end
+@@ -105,34 +105,34 @@
+ 
+     context "handling non-matcher arguments" do
+       it "matches non special symbol (can be removed when deprecated symbols are removed)" do
+-        @double.should_receive(:random_call).with(:some_symbol)
++        expect(@double).to receive(:random_call).with(:some_symbol)
+         @double.random_call(:some_symbol)
+       end
+ 
+       it "matches string against regexp" do
+-        @double.should_receive(:random_call).with(/bcd/)
++        expect(@double).to receive(:random_call).with(/bcd/)
+         @double.random_call("abcde")
+       end
+ 
+       it "matches regexp against regexp" do
+-        @double.should_receive(:random_call).with(/bcd/)
++        expect(@double).to receive(:random_call).with(/bcd/)
+         @double.random_call(/bcd/)
+       end
+ 
+       it "matches against a hash submitted and received by value" do
+-        @double.should_receive(:random_call).with(:a => "a", :b => "b")
++        expect(@double).to receive(:random_call).with(:a => "a", :b => "b")
+         @double.random_call(:a => "a", :b => "b")
+       end
+ 
+       it "matches against a hash submitted by reference and received by value" do
+         opts = {:a => "a", :b => "b"}
+-        @double.should_receive(:random_call).with(opts)
++        expect(@double).to receive(:random_call).with(opts)
+         @double.random_call(:a => "a", :b => "b")
+       end
+ 
+       it "matches against a hash submitted by value and received by reference" do
+         opts = {:a => "a", :b => "b"}
+-        @double.should_receive(:random_call).with(:a => "a", :b => "b")
++        expect(@double).to receive(:random_call).with(:a => "a", :b => "b")
+         @double.random_call(opts)
+       end
+     end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..9a89241
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+clean_test_helper.patch
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
index dcc1601..8e8eeeb 100644
--- a/debian/ruby-tests.rake
+++ b/debian/ruby-tests.rake
@@ -1,7 +1,15 @@
-require 'rspec/core/rake_task'
+#require 'gem2deb/rake/spectask'
+require 'gem2deb/rake/testtask'
 
-RSpec::Core::RakeTask.new(:spec) do |spec|
-  spec.pattern = './spec/**/*_spec.rb'
+#RSpec::Core::RakeTask.new(:spec) do |spec|
+#  spec.pattern = './spec/**/*_spec.rb'
+#end
+
+Rake::TestTask.new do |t|
+  t.libs << "test"
+  t.test_files = FileList['test/**/test*.rb']
+  t.verbose = true
 end
 
-task :default => :spec
+#task :default => :spec
+task :default => :test

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



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