Sha256: abae2b17ae87c7a4b3702dd9ff92d559b8833b9d04761e8e72224a4c8f4e87ef

Contents?: true

Size: 1.97 KB

Versions: 39

Compression:

Stored size: 1.97 KB

Contents

require 'ecloud/spec_helper'

if Fog.mocking?
  #FIXME: with rspec2
  describe "Fog::Ecloud, initialized w/ the TMRK Ecloud module", :type => :mock_tmrk_ecloud_request do
    subject { @vcloud }

    it { should respond_to(:add_node) }

    describe "#add_node" do

      let(:new_node_data) { { :ip_address  => '1.2.3.4',
                              :name        => 'Foo',
                              :port        => '9090',
                              :enabled     => 'true',
                              :description => 'Foo Service'
                            } }

      context "with a valid node services uri" do

        subject { @vcloud.add_node(@mock_service.node_collection.href, new_node_data) }

        it_should_behave_like "all responses"

        let(:service) { @vcloud.vdcs.first.public_ips.first.internet_services.first }

        it "should change the count by 1" do
          expect { subject }.to change { @vcloud.get_nodes(@mock_service.node_collection.href).body[:NodeService].length}.by(1)
        end

        describe "#body" do
          subject { @vcloud.add_node(@mock_service.node_collection.href, new_node_data).body }
          its(:Enabled) { should == new_node_data[:enabled] }
          its(:Port) { should == new_node_data[:port] }
          its(:IpAddress) { should == new_node_data[:ip_address] }
          its(:Name) { should == new_node_data[:name] }
          its(:Description) { should == new_node_data[:description] }
        end

        describe "added mock data" do
          let(:added_mock_node) { @vcloud.mock_data.public_ip_internet_service_node_from_href(subject.body[:Href]) }

          specify { added_mock_node._parent.should == @mock_service.node_collection }
        end
      end

      context "with a nodes uri that doesn't exist" do
        subject { lambda { @vcloud.add_node(URI.parse('https://www.fakey.c/piv8vc99'), new_node_data ) } }

        it_should_behave_like "a request for a resource that doesn't exist"
      end
    end
  end
else
end

Version data entries

39 entries across 39 versions & 8 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
michiels-fog-1.3.1 spec/ecloud/requests/add_node_spec.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
fog-1.3.1 spec/ecloud/requests/add_node_spec.rb
fog-1.3.0 spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
fog-1.2.0 spec/ecloud/requests/add_node_spec.rb
ktheory-fog-1.1.2 spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
fog-1.1.2 spec/ecloud/requests/add_node_spec.rb
fog_tractical-1.1.4 spec/ecloud/requests/add_node_spec.rb
fog_tractical-1.1.3 spec/ecloud/requests/add_node_spec.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/spec/ecloud/requests/add_node_spec.rb
fog-1.1.1 spec/ecloud/requests/add_node_spec.rb
fog-1.1.0 spec/ecloud/requests/add_node_spec.rb