[DRE-commits] [ruby-ridley] 01/02: Update rspec3 patch

Hleb Valoshka tsfgnu-guest at moszumanska.debian.org
Mon Aug 10 15:55:39 UTC 2015


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

tsfgnu-guest pushed a commit to branch master
in repository ruby-ridley.

commit 083b2a0e14569af8dffe8e903bf29142cf48b848
Author: Hleb Valoshka <375gnu at gmail.com>
Date:   Sun Aug 9 16:48:25 2015 +0300

    Update rspec3 patch
---
 ...specs-to-RSpec-3.0.4-syntax-with-Transpec.patch | 527 +++++----------------
 1 file changed, 106 insertions(+), 421 deletions(-)

diff --git a/debian/patches/0002-Convert-specs-to-RSpec-3.0.4-syntax-with-Transpec.patch b/debian/patches/0002-Convert-specs-to-RSpec-3.0.4-syntax-with-Transpec.patch
index ac59a9f..59b4bf3 100644
--- a/debian/patches/0002-Convert-specs-to-RSpec-3.0.4-syntax-with-Transpec.patch
+++ b/debian/patches/0002-Convert-specs-to-RSpec-3.0.4-syntax-with-Transpec.patch
@@ -1,35 +1,8 @@
 From: Hleb Valoshka <375gnu at gmail.com>
-Date: Mon, 3 Aug 2015 14:05:51 +0300
+Date: Sun, 9 Aug 2015 16:42:09 +0300
 Subject: Convert specs to RSpec 3.0.4 syntax with Transpec
 
-This conversion is done by Transpec 3.1.1 with the following command:
-    transpec
-
-* 36 conversions
-    from: be_true
-      to: be_truthy
-
-* 25 conversions
-    from: be_false
-      to: be_falsey
-
-* 18 conversions
-    from: it { should ... }
-      to: it { is_expected.to ... }
-
-* 18 conversions
-    from: obj.stub(:message => value)
-      to: allow(obj).to receive_messages(:message => value)
-
-* 2 conversions
-    from: failure_message_for_should { }
-      to: failure_message { }
-
-* 1 conversion
-    from: failure_message_for_should_not { }
-      to: failure_message_when_negated { }
-
-For more details: https://github.com/yujinakayama/transpec#supported-conversions
+then undone .stub() changes
 ---
  spec/acceptance/client_resource_spec.rb            |  24 +-
  spec/acceptance/cookbook_resource_spec.rb          |  30 +--
@@ -43,38 +16,38 @@ For more details: https://github.com/yujinakayama/transpec#supported-conversions
  spec/acceptance/user_resource_spec.rb              |  42 ++--
  spec/support/each_matcher.rb                       |   4 +-
  spec/support/filepath_matchers.rb                  |   4 +-
- spec/support/shared_examples/ridley_resource.rb    |  76 +++----
+ spec/support/shared_examples/ridley_resource.rb    |  78 +++----
  spec/unit/ridley/chef/cookbook/metadata_spec.rb    |  16 +-
  .../unit/ridley/chef/cookbook/syntax_check_spec.rb |  30 +--
  spec/unit/ridley/chef/cookbook_spec.rb             | 242 +++++++++++----------
  spec/unit/ridley/chef/digester_spec.rb             |   4 +-
  spec/unit/ridley/chef_object_spec.rb               |  70 +++---
+ .../unit/ridley/chef_objects/client_object_spec.rb |   4 +-
  .../ridley/chef_objects/cookbook_object_spec.rb    |  24 +-
  .../chef_objects/data_bag_item_object_spec.rb      |  14 +-
  .../ridley/chef_objects/data_bag_object_spec.rb    |   5 +-
  .../ridley/chef_objects/environment_object_spec.rb |  20 +-
  spec/unit/ridley/chef_objects/node_object_spec.rb  |  56 ++---
  spec/unit/ridley/chef_objects/role_object_spec.rb  |  20 +-
- .../ridley/chef_objects/sandbox_object_spec.rb     |  10 +-
- spec/unit/ridley/client_spec.rb                    |  84 +++++--
- spec/unit/ridley/connection_spec.rb                |  18 +-
+ .../ridley/chef_objects/sandbox_object_spec.rb     |  12 +-
+ spec/unit/ridley/client_spec.rb                    |  80 +++++--
+ spec/unit/ridley/connection_spec.rb                |  14 +-
  spec/unit/ridley/errors_spec.rb                    |   6 +-
  spec/unit/ridley/middleware/chef_auth_spec.rb      |   4 +-
  spec/unit/ridley/middleware/chef_response_spec.rb  |  58 ++---
  spec/unit/ridley/middleware/parse_json_spec.rb     |  28 +--
  spec/unit/ridley/mixins/from_file_spec.rb          |   6 +-
- spec/unit/ridley/resource_spec.rb                  |  34 +--
- spec/unit/ridley/resources/client_resource_spec.rb |  10 +-
- .../ridley/resources/cookbook_resource_spec.rb     |  26 +--
- .../ridley/resources/data_bag_resource_spec.rb     |   7 +-
- .../ridley/resources/environment_resource_spec.rb  |  16 +-
- spec/unit/ridley/resources/node_resource_spec.rb   |   2 +-
- .../unit/ridley/resources/sandbox_resource_spec.rb |  28 +--
- spec/unit/ridley/resources/search_resource_spec.rb |  58 ++---
- spec/unit/ridley/resources/user_resource_spec.rb   |  10 +-
- spec/unit/ridley/sandbox_uploader_spec.rb          |  10 +-
+ spec/unit/ridley/resource_spec.rb                  |  10 +-
+ .../ridley/resources/cookbook_resource_spec.rb     |  20 +-
+ .../resources/data_bag_item_resource_spec.rb       |   2 +-
+ .../ridley/resources/data_bag_resource_spec.rb     |   9 +-
+ .../ridley/resources/environment_resource_spec.rb  |   8 +-
+ spec/unit/ridley/resources/role_resource_spec.rb   |   2 +-
+ .../unit/ridley/resources/sandbox_resource_spec.rb |  14 +-
+ spec/unit/ridley/resources/search_resource_spec.rb |  44 ++--
+ spec/unit/ridley/sandbox_uploader_spec.rb          |   6 +-
  spec/unit/ridley_spec.rb                           |  12 +-
- 43 files changed, 649 insertions(+), 599 deletions(-)
+ 43 files changed, 606 insertions(+), 556 deletions(-)
 
 diff --git a/spec/acceptance/client_resource_spec.rb b/spec/acceptance/client_resource_spec.rb
 index 7262b74..cdee671 100644
@@ -970,7 +943,7 @@ index 8a438c7..b2aac50 100644
    end
  end
 diff --git a/spec/support/shared_examples/ridley_resource.rb b/spec/support/shared_examples/ridley_resource.rb
-index 1dd7d60..2a7b75e 100644
+index 1dd7d60..60422ab 100644
 --- a/spec/support/shared_examples/ridley_resource.rb
 +++ b/spec/support/shared_examples/ridley_resource.rb
 @@ -9,8 +9,8 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
@@ -1029,7 +1002,14 @@ index 1dd7d60..2a7b75e 100644
  
          subject.delete(client, object)
        end
-@@ -66,11 +66,11 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
+@@ -60,17 +60,17 @@ shared_examples_for "a Ridley Resource" do |resource_klass|
+ 
+     describe "::delete_all" do
+       it "sends a delete request for every object in the collection" do
+-        pending
++        skip
+       end
+     end
  
      describe "::update" do
        it "sends a put request to the given client using the includer's resource_path with the given object" do
@@ -2133,6 +2113,23 @@ index 1ea93bb..51cb12b 100644
        end
      end
    end
+diff --git a/spec/unit/ridley/chef_objects/client_object_spec.rb b/spec/unit/ridley/chef_objects/client_object_spec.rb
+index 7c39275..694eebb 100644
+--- a/spec/unit/ridley/chef_objects/client_object_spec.rb
++++ b/spec/unit/ridley/chef_objects/client_object_spec.rb
+@@ -2,10 +2,10 @@ require 'spec_helper'
+ 
+ describe Ridley::ClientObject do
+   describe "#to_json" do
+-    pending
++    skip
+   end
+ 
+   describe "#regenerate_key" do
+-    pending
++    skip
+   end
+ end
 diff --git a/spec/unit/ridley/chef_objects/cookbook_object_spec.rb b/spec/unit/ridley/chef_objects/cookbook_object_spec.rb
 index eec7f18..a15514d 100644
 --- a/spec/unit/ridley/chef_objects/cookbook_object_spec.rb
@@ -2598,10 +2595,10 @@ index 36a9818..3029df4 100644
      end
    end
 diff --git a/spec/unit/ridley/chef_objects/sandbox_object_spec.rb b/spec/unit/ridley/chef_objects/sandbox_object_spec.rb
-index 6f20a53..fd42b44 100644
+index 6f20a53..6e879e4 100644
 --- a/spec/unit/ridley/chef_objects/sandbox_object_spec.rb
 +++ b/spec/unit/ridley/chef_objects/sandbox_object_spec.rb
-@@ -24,7 +24,7 @@ describe Ridley::SandboxObject do
+@@ -24,15 +24,15 @@ describe Ridley::SandboxObject do
      )
    end
  
@@ -2609,8 +2606,9 @@ index 6f20a53..fd42b44 100644
 +  before { allow(subject).to receive_messages(resource: resource) }
  
    describe "#checksums" do
-     pending
-@@ -32,7 +32,7 @@ describe Ridley::SandboxObject do
+-    pending
++    skip
+   end
  
    describe "#commit" do
      let(:response) { { is_completed: nil} }
@@ -2647,7 +2645,7 @@ index 6f20a53..fd42b44 100644
        subject.upload(checksums)
      end
 diff --git a/spec/unit/ridley/client_spec.rb b/spec/unit/ridley/client_spec.rb
-index 5a2eb16..220f2c8 100644
+index 5a2eb16..0b3ff4c 100644
 --- a/spec/unit/ridley/client_spec.rb
 +++ b/spec/unit/ridley/client_spec.rb
 @@ -32,9 +32,20 @@ describe Ridley::Client do
@@ -2728,7 +2726,7 @@ index 5a2eb16..220f2c8 100644
  
          described_class.open do |f|
            f.hello
-@@ -126,22 +137,49 @@ describe Ridley::Client do
+@@ -126,18 +137,45 @@ describe Ridley::Client do
  
    subject { instance }
  
@@ -2782,22 +2780,8 @@ index 5a2eb16..220f2c8 100644
  
      context "when a encrypted_data_bag_secret_path is not provided" do
        before(:each) do
--        instance.stub(encrypted_data_bag_secret_path: nil)
-+        allow(instance).to receive_messages(encrypted_data_bag_secret_path: nil)
-       end
- 
-       it "returns nil" do
-@@ -151,7 +189,7 @@ describe Ridley::Client do
- 
-     context "when the file is not found at the given encrypted_data_bag_secret_path" do
-       before(:each) do
--        instance.stub(encrypted_data_bag_secret_path: fixtures_path.join("not.txt").to_s)
-+        allow(instance).to receive_messages(encrypted_data_bag_secret_path: fixtures_path.join("not.txt").to_s)
-       end
- 
-       it "raises an EncryptedDataBagSecretNotFound erorr" do
 diff --git a/spec/unit/ridley/connection_spec.rb b/spec/unit/ridley/connection_spec.rb
-index 9666b59..4a1c7ba 100644
+index 9666b59..689ac96 100644
 --- a/spec/unit/ridley/connection_spec.rb
 +++ b/spec/unit/ridley/connection_spec.rb
 @@ -18,7 +18,7 @@ describe Ridley::Connection do
@@ -2809,7 +2793,7 @@ index 9666b59..4a1c7ba 100644
      end
  
      context "given a configured count of two (2) retries" do
-@@ -31,22 +31,22 @@ describe Ridley::Connection do
+@@ -31,7 +31,7 @@ describe Ridley::Connection do
            subject.get('organizations/vialstudios')
          }.to raise_error
  
@@ -2818,19 +2802,16 @@ index 9666b59..4a1c7ba 100644
        end
      end
    end
- 
-   describe "#api_type" do
+@@ -40,13 +40,13 @@ describe Ridley::Connection do
      it "returns :foss if the organization is not set" do
--      subject.stub(:organization).and_return(nil)
-+      allow(subject).to receive(:organization).and_return(nil)
+       subject.stub(:organization).and_return(nil)
  
 -      subject.api_type.should eql(:foss)
 +      expect(subject.api_type).to eql(:foss)
      end
  
      it "returns :hosted if the organization is set" do
--      subject.stub(:organization).and_return("vialstudios")
-+      allow(subject).to receive(:organization).and_return("vialstudios")
+       subject.stub(:organization).and_return("vialstudios")
  
 -      subject.api_type.should eql(:hosted)
 +      expect(subject.api_type).to eql(:hosted)
@@ -3161,7 +3142,7 @@ index acf188d..cf33581 100644
  
          it 'raises a FromFileParserError' do
 diff --git a/spec/unit/ridley/resource_spec.rb b/spec/unit/ridley/resource_spec.rb
-index 24d3cb3..0fa12f7 100644
+index 24d3cb3..3cba8e0 100644
 --- a/spec/unit/ridley/resource_spec.rb
 +++ b/spec/unit/ridley/resource_spec.rb
 @@ -22,7 +22,7 @@ describe Ridley::Resource do
@@ -3191,57 +3172,7 @@ index 24d3cb3..0fa12f7 100644
          end
        end
      end
-@@ -53,14 +53,14 @@ describe Ridley::Resource do
-   subject { resource_class.new(double('registry')) }
- 
-   before do
--    resource_class.stub(representation: representation)
--    subject.stub(connection: connection)
-+    allow(resource_class).to receive_messages(representation: representation)
-+    allow(subject).to receive_messages(connection: connection)
-   end
- 
-   describe "::from_file" do
-     it "reads the file and calls ::from_json with contents" do
--      File.stub(:read) { resource_json }
--      subject.should_receive(:from_json).with(resource_json)
-+      allow(File).to receive(:read) { resource_json }
-+      expect(subject).to receive(:from_json).with(resource_json)
-       subject.from_file('/bogus/filename.json')
-     end
-   end
-@@ -68,14 +68,14 @@ describe Ridley::Resource do
-   describe "::from_json" do
-     it "parses the argument and calls ::new with newly built hash" do
-       hashed_json = JSON.parse(resource_json)
--      subject.should_receive(:new).with(hashed_json).and_return representation
-+      expect(subject).to receive(:new).with(hashed_json).and_return representation
-       subject.from_json(resource_json)
-     end
-   end
- 
-   describe "::all" do
-     it "sends GET to /{resource_path}" do
--      connection.should_receive(:get).with(subject.class.resource_path).and_return(response)
-+      expect(connection).to receive(:get).with(subject.class.resource_path).and_return(response)
- 
-       subject.all
-     end
-@@ -85,19 +85,19 @@ describe Ridley::Resource do
-     let(:id) { "some_id" }
- 
-     it "sends GET to /{resource_path}/{id} where {id} is the given ID" do
--      connection.should_receive(:get).with("#{subject.class.resource_path}/#{id}").and_return(response)
-+      expect(connection).to receive(:get).with("#{subject.class.resource_path}/#{id}").and_return(response)
- 
-       subject.find(id)
-     end
- 
-     context "when the resource is not found" do
-       before do
--        connection.should_receive(:get).with("#{subject.class.resource_path}/#{id}").
-+        expect(connection).to receive(:get).with("#{subject.class.resource_path}/#{id}").
-           and_raise(Ridley::Errors::HTTPNotFound.new({}))
+@@ -97,7 +97,7 @@ describe Ridley::Resource do
        end
  
        it "returns nil" do
@@ -3250,97 +3181,19 @@ index 24d3cb3..0fa12f7 100644
        end
      end
    end
-@@ -111,7 +111,7 @@ describe Ridley::Resource do
-     end
- 
-     it "sends a post request to the given client using the includer's resource_path" do
--      connection.should_receive(:post).with(subject.class.resource_path, duck_type(:to_json)).and_return(response)
-+      expect(connection).to receive(:post).with(subject.class.resource_path, duck_type(:to_json)).and_return(response)
- 
-       subject.create(attrs)
-     end
-@@ -119,15 +119,15 @@ describe Ridley::Resource do
- 
-   describe "::delete" do
-     it "sends a delete request to the given client using the includer's resource_path for the given string" do
--      connection.should_receive(:delete).with("#{subject.class.resource_path}/ridley-test").and_return(response)
-+      expect(connection).to receive(:delete).with("#{subject.class.resource_path}/ridley-test").and_return(response)
- 
-       subject.delete("ridley-test")
-     end
- 
-     it "accepts an object that responds to 'chef_id'" do
-       object = double("obj")
--      object.stub(:chef_id) { "hello" }
--      connection.should_receive(:delete).with("#{subject.class.resource_path}/#{object.chef_id}").and_return(response)
-+      allow(object).to receive(:chef_id) { "hello" }
-+      expect(connection).to receive(:delete).with("#{subject.class.resource_path}/#{object.chef_id}").and_return(response)
+@@ -135,7 +135,7 @@ describe Ridley::Resource do
  
-       subject.delete( object)
+   describe "::delete_all" do
+     it "sends a delete request for every object in the collection" do
+-      pending
++      skip
      end
-@@ -142,7 +142,7 @@ describe Ridley::Resource do
-   describe "::update" do
-     it "sends a put request to the given client using the includer's resource_path with the given object" do
-       object = subject.new(name: "hello")
--      connection.should_receive(:put).
-+      expect(connection).to receive(:put).
-         with("#{subject.class.resource_path}/#{object.chef_id}", duck_type(:to_json)).and_return(response)
- 
-       subject.update(object)
-diff --git a/spec/unit/ridley/resources/client_resource_spec.rb b/spec/unit/ridley/resources/client_resource_spec.rb
-index d721018..e6787b6 100644
---- a/spec/unit/ridley/resources/client_resource_spec.rb
-+++ b/spec/unit/ridley/resources/client_resource_spec.rb
-@@ -5,22 +5,22 @@ describe Ridley::ClientResource do
- 
-   describe "#regenerate_key" do
-     let(:client_id) { "rspec-client" }
--    before { subject.stub(find: nil) }
-+    before { allow(subject).to receive_messages(find: nil) }
- 
-     context "when a client with the given ID exists" do
-       let(:client) { double('chef-client') }
--      before { subject.should_receive(:find).with(client_id).and_return(client) }
-+      before { expect(subject).to receive(:find).with(client_id).and_return(client) }
- 
-       it "sets the private key to true and updates the client" do
--        client.should_receive(:private_key=).with(true)
--        subject.should_receive(:update).with(client)
-+        expect(client).to receive(:private_key=).with(true)
-+        expect(subject).to receive(:update).with(client)
- 
-         subject.regenerate_key(client_id)
-       end
-     end
- 
-     context "when a client with the given ID does not exist" do
--      before { subject.should_receive(:find).with(client_id).and_return(nil) }
-+      before { expect(subject).to receive(:find).with(client_id).and_return(nil) }
+   end
  
-       it "raises a ResourceNotFound error" do
-         expect {
 diff --git a/spec/unit/ridley/resources/cookbook_resource_spec.rb b/spec/unit/ridley/resources/cookbook_resource_spec.rb
-index 0af7b4a..18dcb9a 100644
+index 0af7b4a..a542838 100644
 --- a/spec/unit/ridley/resources/cookbook_resource_spec.rb
 +++ b/spec/unit/ridley/resources/cookbook_resource_spec.rb
-@@ -5,7 +5,7 @@ describe Ridley::CookbookResource do
-   let(:client_key) { fixtures_path.join('reset.pem') }
-   let(:connection) { Ridley::Connection.new("http://localhost:8889", "reset", fixtures_path.join("reset.pem").to_s) }
-   subject { described_class.new(double('registry'), client_name, client_key) }
--  before  { subject.stub(connection: connection) }
-+  before  { allow(subject).to receive_messages(connection: connection) }
- 
-   describe "#download" do
-     let(:name) { "example_cookbook" }
-@@ -13,7 +13,7 @@ describe Ridley::CookbookResource do
-     let(:destination) { tmp_path.join("example_cookbook-0.1.0").to_s }
- 
-     context "when the cookbook of the name/version is not found" do
--      before { subject.should_receive(:find).with(name, version).and_return(nil) }
-+      before { expect(subject).to receive(:find).with(name, version).and_return(nil) }
- 
-       it "raises a ResourceNotFound error" do
-         expect {
 @@ -42,7 +42,7 @@ describe Ridley::CookbookResource do
        end
  
@@ -3395,28 +3248,30 @@ index 0af7b4a..18dcb9a 100644
        end
      end
  
-@@ -122,14 +122,14 @@ describe Ridley::CookbookResource do
-     let(:sandbox) { double('sandbox', upload: nil, commit: nil) }
- 
-     before do
--      subject.stub(:sandbox_resource).and_return(sandbox_resource)
-+      allow(subject).to receive(:sandbox_resource).and_return(sandbox_resource)
-     end
+@@ -148,6 +148,6 @@ describe Ridley::CookbookResource do
+   end
  
-     it 'does not include files that are ignored' do
-       # These are the MD5s for the files. It's not possible to check that
-       # the ignored files weren't uploaded, so we just check that the
-       # non-ignored files are the ONLY thing uploaded
--      sandbox_resource.should_receive(:create).with([
-+      expect(sandbox_resource).to receive(:create).with([
-         "211a3a8798d4acd424af15ff8a2e28a5",
-         "64ac6346672c6bea4ade983e3d58cd14",
-         "75077ba33d2887cc1746d1ef716bf8b7",
+   describe "#update" do
+-    pending
++    skip
+   end
+ end
+diff --git a/spec/unit/ridley/resources/data_bag_item_resource_spec.rb b/spec/unit/ridley/resources/data_bag_item_resource_spec.rb
+index 19ce649..578d880 100644
+--- a/spec/unit/ridley/resources/data_bag_item_resource_spec.rb
++++ b/spec/unit/ridley/resources/data_bag_item_resource_spec.rb
+@@ -3,5 +3,5 @@ require 'spec_helper'
+ describe Ridley::DataBagItemResource do
+   subject { described_class.new(double) }
+ 
+-  pending
++  skip
+ end
 diff --git a/spec/unit/ridley/resources/data_bag_resource_spec.rb b/spec/unit/ridley/resources/data_bag_resource_spec.rb
-index c814040..021bfdc 100644
+index c814040..0dcee88 100644
 --- a/spec/unit/ridley/resources/data_bag_resource_spec.rb
 +++ b/spec/unit/ridley/resources/data_bag_resource_spec.rb
-@@ -8,10 +8,13 @@ describe Ridley::DataBagResource do
+@@ -8,13 +8,16 @@ describe Ridley::DataBagResource do
      subject { instance.item_resource }
  
      it "returns a DataBagItemResource" do
@@ -3432,19 +3287,14 @@ index c814040..021bfdc 100644
    end
  
    describe "#find" do
+-    pending
++    skip
+   end
+ end
 diff --git a/spec/unit/ridley/resources/environment_resource_spec.rb b/spec/unit/ridley/resources/environment_resource_spec.rb
-index c38dca5..7f672e0 100644
+index c38dca5..8499181 100644
 --- a/spec/unit/ridley/resources/environment_resource_spec.rb
 +++ b/spec/unit/ridley/resources/environment_resource_spec.rb
-@@ -8,7 +8,7 @@ describe Ridley::EnvironmentResource do
- 
-   let(:resource) do
-     resource = described_class.new(double('registry'))
--    resource.stub(connection: connection)
-+    allow(resource).to receive_messages(connection: connection)
-     resource
-   end
- 
 @@ -28,13 +28,13 @@ describe Ridley::EnvironmentResource do
        end
  
@@ -3463,56 +3313,22 @@ index c38dca5..7f672e0 100644
        end
      end
  
-@@ -61,12 +61,12 @@ describe Ridley::EnvironmentResource do
-     let(:destroy_env) { double(name: "destroy_me") }
- 
-     before do
--      subject.stub(all: [ default_env, destroy_env ])
-+      allow(subject).to receive_messages(all: [ default_env, destroy_env ])
-     end
- 
-     it "does not destroy the '_default' environment" do
--      subject.stub(future: double('future', value: nil))
--      subject.should_not_receive(:future).with(:delete, default_env)
-+      allow(subject).to receive_messages(future: double('future', value: nil))
-+      expect(subject).not_to receive(:future).with(:delete, default_env)
- 
-       subject.delete_all
-     end
-diff --git a/spec/unit/ridley/resources/node_resource_spec.rb b/spec/unit/ridley/resources/node_resource_spec.rb
-index fb4abac..84c43bf 100644
---- a/spec/unit/ridley/resources/node_resource_spec.rb
-+++ b/spec/unit/ridley/resources/node_resource_spec.rb
-@@ -3,7 +3,7 @@ require 'spec_helper'
- describe Ridley::NodeResource do
-   let(:instance) do
-     inst = described_class.new(double)
--    inst.stub(connection: chef_zero_connection)
-+    allow(inst).to receive_messages(connection: chef_zero_connection)
-     inst
-   end
+diff --git a/spec/unit/ridley/resources/role_resource_spec.rb b/spec/unit/ridley/resources/role_resource_spec.rb
+index 819188a..a8788c2 100644
+--- a/spec/unit/ridley/resources/role_resource_spec.rb
++++ b/spec/unit/ridley/resources/role_resource_spec.rb
+@@ -3,5 +3,5 @@ require 'spec_helper'
+ describe Ridley::RoleResource do
+   subject { described_class.new(double) }
  
+-  pending
++  skip
+ end
 diff --git a/spec/unit/ridley/resources/sandbox_resource_spec.rb b/spec/unit/ridley/resources/sandbox_resource_spec.rb
-index d215dd0..b831c41 100644
+index d215dd0..e8a2437 100644
 --- a/spec/unit/ridley/resources/sandbox_resource_spec.rb
 +++ b/spec/unit/ridley/resources/sandbox_resource_spec.rb
-@@ -5,7 +5,7 @@ describe Ridley::SandboxResource do
-   let(:client_key) { fixtures_path.join('reset.pem') }
-   let(:connection) { double('chef-connection') }
-   subject { described_class.new(double, client_name, client_key) }
--  before  { subject.stub(connection: connection) }
-+  before  { allow(subject).to receive_messages(connection: connection) }
- 
-   describe "#create" do
-     let(:sandbox_id) { "bd091b150b0a4578b97771af6abf3e05" }
-@@ -16,30 +16,30 @@ describe Ridley::SandboxResource do
-     end
- 
-     before(:each) do
--      connection.stub(:post).
-+      allow(connection).to receive(:post).
-         with(subject.class.resource_path, JSON.fast_generate(checksums: checksums)).
-         and_return(response)
+@@ -22,24 +22,24 @@ describe Ridley::SandboxResource do
      end
  
      it "returns a Ridley::SandboxObject" do
@@ -3552,52 +3368,8 @@ index d215dd0..b831c41 100644
        end
      end
    end
-@@ -77,14 +77,14 @@ describe Ridley::SandboxResource do
-     end
- 
-     it "sends a /PUT to the sandbox resource with is_complete set to true" do
--      connection.should_receive(:put).with(sandbox_path, JSON.fast_generate(is_completed: true)).and_return(response)
-+      expect(connection).to receive(:put).with(sandbox_path, JSON.fast_generate(is_completed: true)).and_return(response)
- 
-       subject.commit(sandbox_id)
-     end
- 
-     context "when a sandbox of the given ID is not found" do
-       before do
--        connection.should_receive(:put).and_raise(Ridley::Errors::HTTPNotFound.new({}))
-+        expect(connection).to receive(:put).and_raise(Ridley::Errors::HTTPNotFound.new({}))
-       end
- 
-       it "raises a ResourceNotFound error" do
-@@ -96,7 +96,7 @@ describe Ridley::SandboxResource do
- 
-     context "when the given sandbox contents are malformed" do
-       before do
--        connection.should_receive(:put).and_raise(Ridley::Errors::HTTPBadRequest.new({}))
-+        expect(connection).to receive(:put).and_raise(Ridley::Errors::HTTPBadRequest.new({}))
-       end
- 
-       it "raises a SandboxCommitError error" do
-@@ -108,7 +108,7 @@ describe Ridley::SandboxResource do
- 
-     context "when the user who made the request is not authorized" do
-       it "raises a PermissionDenied error on unauthorized" do
--        connection.should_receive(:put).and_raise(Ridley::Errors::HTTPUnauthorized.new({}))
-+        expect(connection).to receive(:put).and_raise(Ridley::Errors::HTTPUnauthorized.new({}))
- 
-         expect {
-           subject.commit(sandbox_id)
-@@ -116,7 +116,7 @@ describe Ridley::SandboxResource do
-       end
- 
-       it "raises a PermissionDenied error on forbidden" do
--        connection.should_receive(:put).and_raise(Ridley::Errors::HTTPForbidden.new({}))
-+        expect(connection).to receive(:put).and_raise(Ridley::Errors::HTTPForbidden.new({}))
- 
-         expect {
-           subject.commit(sandbox_id)
 diff --git a/spec/unit/ridley/resources/search_resource_spec.rb b/spec/unit/ridley/resources/search_resource_spec.rb
-index dd2406e..f926b4e 100644
+index dd2406e..d29465b 100644
 --- a/spec/unit/ridley/resources/search_resource_spec.rb
 +++ b/spec/unit/ridley/resources/search_resource_spec.rb
 @@ -11,8 +11,8 @@ describe Ridley::SearchResource do
@@ -3644,7 +3416,7 @@ index dd2406e..f926b4e 100644
          end
        end
      end
-@@ -89,14 +89,14 @@ describe Ridley::SearchResource do
+@@ -89,7 +89,7 @@ describe Ridley::SearchResource do
  
      describe "::query_uri" do
        it "returns a URI path containing the search resource path and index" do
@@ -3653,26 +3425,7 @@ index dd2406e..f926b4e 100644
        end
      end
    end
- 
-   let(:connection) { double('chef-connection') }
-   subject { described_class.new(double('registry')) }
--  before  { subject.stub(connection: connection) }
-+  before  { allow(subject).to receive_messages(connection: connection) }
- 
-   describe "#indexes" do
-     let(:response) do
-@@ -109,16 +109,16 @@ describe Ridley::SearchResource do
-     end
- 
-     before do
--      connection.stub(:get).with(described_class.resource_path).and_return(response)
-+      allow(connection).to receive(:get).with(described_class.resource_path).and_return(response)
-     end
- 
-     it "performs a GET to the search resource_path" do
--      connection.should_receive(:get).with(described_class.resource_path).and_return(response)
-+      expect(connection).to receive(:get).with(described_class.resource_path).and_return(response)
-       subject.indexes
+@@ -118,7 +118,7 @@ describe Ridley::SearchResource do
      end
  
      it "contains a key for each index" do
@@ -3681,26 +3434,6 @@ index dd2406e..f926b4e 100644
      end
    end
  
-@@ -138,15 +138,15 @@ describe Ridley::SearchResource do
-     let(:run) { subject.run(index, query_string, registry) }
- 
-     before do
--      connection.stub(:get).and_return(response)
-+      allow(connection).to receive(:get).and_return(response)
-     end
- 
-     it "builds a query and runs it against the index's resource path" do
-       query     = double('query')
-       query_uri = double('query-uri')
--      described_class.should_receive(:build_query).with(query_string, options).and_return(query)
--      described_class.should_receive(:query_uri).with(index).and_return(query_uri)
--      connection.should_receive(:get).with(query_uri, query).and_return(response)
-+      expect(described_class).to receive(:build_query).with(query_string, options).and_return(query)
-+      expect(described_class).to receive(:query_uri).with(index).and_return(query_uri)
-+      expect(connection).to receive(:get).with(query_uri, query).and_return(response)
- 
-       subject.run(index, query_string, options)
-     end
 @@ -179,8 +179,8 @@ describe Ridley::SearchResource do
        it "returns an array of Ridley::NodeObject" do
          result = run
@@ -3781,40 +3514,8 @@ index dd2406e..f926b4e 100644
          end
        end
      end
-diff --git a/spec/unit/ridley/resources/user_resource_spec.rb b/spec/unit/ridley/resources/user_resource_spec.rb
-index 3ccc800..5d8c419 100644
---- a/spec/unit/ridley/resources/user_resource_spec.rb
-+++ b/spec/unit/ridley/resources/user_resource_spec.rb
-@@ -6,22 +6,22 @@ describe Ridley::UserResource, type: 'wip' do
-   let(:user_password) { "swordfish" }
- 
-   describe "#regenerate_key" do
--    before { subject.stub(find: nil) }
-+    before { allow(subject).to receive_messages(find: nil) }
- 
-     context "when a user with the given ID exists" do
-       let(:user) { double('chef-user') }
--      before { subject.should_receive(:find).with(user_id).and_return(user) }
-+      before { expect(subject).to receive(:find).with(user_id).and_return(user) }
- 
-       it "sets the private key to true and updates the user" do
--        user.should_receive(:private_key=).with(true)
--        subject.should_receive(:update).with(user)
-+        expect(user).to receive(:private_key=).with(true)
-+        expect(subject).to receive(:update).with(user)
- 
-         subject.regenerate_key(user_id)
-       end
-     end
- 
-     context "when a user with the given ID does not exist" do
--      before { subject.should_receive(:find).with(user_id).and_return(nil) }
-+      before { expect(subject).to receive(:find).with(user_id).and_return(nil) }
- 
-       it "raises a ResourceNotFound error" do
-         expect {
 diff --git a/spec/unit/ridley/sandbox_uploader_spec.rb b/spec/unit/ridley/sandbox_uploader_spec.rb
-index 1e5bca2..b691458 100644
+index 1e5bca2..5955fe3 100644
 --- a/spec/unit/ridley/sandbox_uploader_spec.rb
 +++ b/spec/unit/ridley/sandbox_uploader_spec.rb
 @@ -8,14 +8,14 @@ describe Ridley::SandboxUploader do
@@ -3834,16 +3535,7 @@ index 1e5bca2..b691458 100644
      end
    end
  
-@@ -47,7 +47,7 @@ describe Ridley::SandboxUploader do
-     let(:path) { fixtures_path.join('reset.pem').to_s }
-     let(:different_path) { fixtures_path.join('recipe_one.rb').to_s }
- 
--    before { connection.stub(foss?: false) }
-+    before { allow(connection).to receive_messages(foss?: false) }
- 
-     context "when the checksum needs uploading" do
-       let(:checksums) do
-@@ -80,13 +80,13 @@ describe Ridley::SandboxUploader do
+@@ -80,7 +80,7 @@ describe Ridley::SandboxUploader do
        end
  
        it "returns nil" do
@@ -3852,13 +3544,6 @@ index 1e5bca2..b691458 100644
        end
      end
  
-     context "when the connection is an open source server connection with a non-80 port" do
-       before do
--        connection.stub(foss?: true, server_url: "http://localhost:8889")
-+        allow(connection).to receive_messages(foss?: true, server_url: "http://localhost:8889")
-       end
- 
-       let(:checksums) do
 diff --git a/spec/unit/ridley_spec.rb b/spec/unit/ridley_spec.rb
 index ab47938..d2da78a 100644
 --- a/spec/unit/ridley_spec.rb

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



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