Sha256: 24b8980717b7b832e10f9e26b6603bc0fba6149e1a3c3bea1bfa0abe9a6bfc8b

Contents?: true

Size: 1.89 KB

Versions: 43

Compression:

Stored size: 1.89 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

module MCollective
  module DDL
    describe DiscoveryDDL do
      before :each do
        Cache.delete!(:ddl) rescue nil
        @ddl = DDL.new("rspec", :discovery, false)
        @ddl.metadata(:name => "name", :description => "description", :author => "author", :license => "license", :version => "version", :url => "url", :timeout => "timeout")
      end

      describe "#discovery_interface" do
        it "should return correct data" do
          @ddl.instance_variable_set("@plugintype", :discovery)
          @ddl.discovery do
            @ddl.capabilities :identity
          end

          @ddl.discovery_interface.should == {:capabilities => [:identity]}
        end
      end

      describe "#capabilities" do
        it "should support non arrays" do
          @ddl.instance_variable_set("@plugintype", :discovery)
          @ddl.discovery do
            @ddl.capabilities :identity
          end
          @ddl.discovery_interface.should == {:capabilities => [:identity]}
        end

        it "should not accept empty capability lists" do
          @ddl.instance_variable_set("@plugintype", :discovery)
          @ddl.discovery do
            expect { @ddl.capabilities [] }.to raise_error("Discovery plugin capabilities can't be empty")
          end
        end

        it "should only accept known capabilities" do
          @ddl.instance_variable_set("@plugintype", :discovery)
          @ddl.discovery do
            expect { @ddl.capabilities :rspec }.to raise_error(/rspec is not a valid capability/)
          end
        end

        it "should correctly store the capabilities" do
          @ddl.instance_variable_set("@plugintype", :discovery)
          @ddl.discovery do
            @ddl.capabilities [:identity, :classes]
          end
          @ddl.discovery_interface.should == {:capabilities => [:identity, :classes]}
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
mcollective-client-2.12.5 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.12.4 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.12.3 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.12.1 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.12.0 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.6 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.11.4 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.11.3 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.11.2 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.11.1 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.11.0 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.4 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.3 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.2 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.1 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.10.0 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.8.7 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.8.5 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.8.8 spec/unit/mcollective/ddl/discoveryddl_spec.rb
mcollective-client-2.8.6 spec/unit/mcollective/ddl/discoveryddl_spec.rb