summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-03-23 16:39:42 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-03-23 16:39:42 -0700
commit0bdbe18b3f3981c1e1f661e211e20ccab1278f81 (patch)
treec602ca1f0777073be8cf789f643296b86515eeff /spec/unit/interface
parent635751d809af309c7c36c0c9d7a94a731ef8bd1c (diff)
parentc25fb94725c9abfb36e67938356f97823f8b605e (diff)
downloadpuppet-0bdbe18b3f3981c1e1f661e211e20ccab1278f81.tar.gz
puppet-0bdbe18b3f3981c1e1f661e211e20ccab1278f81.tar.xz
puppet-0bdbe18b3f3981c1e1f661e211e20ccab1278f81.zip
Merge branch 'tickets/master/6770'
Conflicts: lib/puppet/interface/certificate.rb spec/unit/application/interface_base_spec.rb spec/unit/interface/interface_collection_spec.rb
Diffstat (limited to 'spec/unit/interface')
-rw-r--r--spec/unit/interface/action_builder_spec.rb2
-rw-r--r--spec/unit/interface/action_spec.rb4
-rw-r--r--spec/unit/interface/catalog_spec.rb3
-rw-r--r--spec/unit/interface/certificate_request_spec.rb3
-rw-r--r--spec/unit/interface/certificate_revocation_list_spec.rb3
-rw-r--r--spec/unit/interface/certificate_spec.rb3
-rw-r--r--spec/unit/interface/config_spec.rb3
-rw-r--r--spec/unit/interface/configurer_spec.rb5
-rw-r--r--spec/unit/interface/facts_spec.rb3
-rw-r--r--spec/unit/interface/file_spec.rb3
-rw-r--r--spec/unit/interface/indirector_spec.rb4
-rw-r--r--spec/unit/interface/interface_collection_spec.rb40
-rw-r--r--spec/unit/interface/key_spec.rb3
-rw-r--r--spec/unit/interface/node_spec.rb3
-rw-r--r--spec/unit/interface/report_spec.rb3
-rw-r--r--spec/unit/interface/resource_spec.rb3
-rw-r--r--spec/unit/interface/resource_type_spec.rb3
17 files changed, 38 insertions, 53 deletions
diff --git a/spec/unit/interface/action_builder_spec.rb b/spec/unit/interface/action_builder_spec.rb
index 39b2386dc..2c2f3b14c 100644
--- a/spec/unit/interface/action_builder_spec.rb
+++ b/spec/unit/interface/action_builder_spec.rb
@@ -13,7 +13,7 @@ describe Puppet::Interface::ActionBuilder do
end
it "should define a method on the interface which invokes the action" do
- interface = Puppet::Interface.new(:action_builder_test_interface)
+ interface = Puppet::Interface.new(:action_builder_test_interface, :version => '0.0.1')
action = Puppet::Interface::ActionBuilder.build(interface, :foo) do
invoke do
"invoked the method"
diff --git a/spec/unit/interface/action_spec.rb b/spec/unit/interface/action_spec.rb
index e74fa9fcc..246ae9622 100644
--- a/spec/unit/interface/action_spec.rb
+++ b/spec/unit/interface/action_spec.rb
@@ -24,7 +24,7 @@ describe Puppet::Interface::Action do
describe "when invoking" do
it "should be able to call other actions on the same object" do
- interface = Puppet::Interface.new(:my_interface) do
+ interface = Puppet::Interface.new(:my_interface, :version => '0.0.1') do
action(:foo) do
invoke { 25 }
end
@@ -56,7 +56,7 @@ describe Puppet::Interface::Action do
end
end
- interface = Puppet::Interface::MyInterfaceBaseClass.new(:my_inherited_interface) do
+ interface = Puppet::Interface::MyInterfaceBaseClass.new(:my_inherited_interface, :version => '0.0.1') do
action(:baz) do
invoke { "the value of foo in baz is '#{foo}'" }
end
diff --git a/spec/unit/interface/catalog_spec.rb b/spec/unit/interface/catalog_spec.rb
index 78d62110f..c615181ed 100644
--- a/spec/unit/interface/catalog_spec.rb
+++ b/spec/unit/interface/catalog_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/catalog'
-describe Puppet::Interface::Indirector.interface(:catalog) do
+describe Puppet::Interface.define(:catalog, '0.0.1') do
end
diff --git a/spec/unit/interface/certificate_request_spec.rb b/spec/unit/interface/certificate_request_spec.rb
index a6ab8d17e..0143ebc85 100644
--- a/spec/unit/interface/certificate_request_spec.rb
+++ b/spec/unit/interface/certificate_request_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/certificate_request'
-describe Puppet::Interface::Indirector.interface(:certificate_request) do
+describe Puppet::Interface.define(:certificate_request, '0.0.1') do
end
diff --git a/spec/unit/interface/certificate_revocation_list_spec.rb b/spec/unit/interface/certificate_revocation_list_spec.rb
index a98b48d90..9655dd3fa 100644
--- a/spec/unit/interface/certificate_revocation_list_spec.rb
+++ b/spec/unit/interface/certificate_revocation_list_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/certificate_revocation_list'
-describe Puppet::Interface::Indirector.interface(:certificate_revocation_list) do
+describe Puppet::Interface.define(:certificate_revocation_list, '0.0.1') do
end
diff --git a/spec/unit/interface/certificate_spec.rb b/spec/unit/interface/certificate_spec.rb
index 6a325343f..e5c63e456 100644
--- a/spec/unit/interface/certificate_spec.rb
+++ b/spec/unit/interface/certificate_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/certificate'
-describe Puppet::Interface::Indirector.interface(:certificate) do
+describe Puppet::Interface.define(:certificate, '0.0.1') do
end
diff --git a/spec/unit/interface/config_spec.rb b/spec/unit/interface/config_spec.rb
index e8aafd4a3..a2ec7b528 100644
--- a/spec/unit/interface/config_spec.rb
+++ b/spec/unit/interface/config_spec.rb
@@ -1,9 +1,8 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/config'
-describe Puppet::Interface.interface(:config) do
+describe Puppet::Interface.define(:config, '0.0.1') do
it "should use Settings#print_config_options when asked to print" do
Puppet.settings.stubs(:puts)
Puppet.settings.expects(:print_config_options)
diff --git a/spec/unit/interface/configurer_spec.rb b/spec/unit/interface/configurer_spec.rb
index 4b3532c1b..e97e63b65 100644
--- a/spec/unit/interface/configurer_spec.rb
+++ b/spec/unit/interface/configurer_spec.rb
@@ -1,11 +1,10 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/configurer'
require 'puppet/indirector/catalog/rest'
require 'tempfile'
-describe Puppet::Interface.interface(:configurer) do
+describe Puppet::Interface.define(:configurer, '0.0.1') do
describe "#synchronize" do
it "should retrieve and apply a catalog and return a report" do
dirname = Dir.mktmpdir("puppetdir")
@@ -16,7 +15,7 @@ describe Puppet::Interface.interface(:configurer) do
@catalog.add_resource(@file)
Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog)
- report = Puppet::Interface.interface(:configurer).synchronize("foo")
+ report = subject.synchronize("foo")
report.kind.should == "apply"
report.status.should == "changed"
diff --git a/spec/unit/interface/facts_spec.rb b/spec/unit/interface/facts_spec.rb
index d0f87d3a0..5f0214fd5 100644
--- a/spec/unit/interface/facts_spec.rb
+++ b/spec/unit/interface/facts_spec.rb
@@ -1,9 +1,8 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/facts'
-describe Puppet::Interface::Indirector.interface(:facts) do
+describe Puppet::Interface.define(:facts, '0.0.1') do
it "should define an 'upload' fact" do
subject.should be_action(:upload)
end
diff --git a/spec/unit/interface/file_spec.rb b/spec/unit/interface/file_spec.rb
index 54427a267..bd6e31c0e 100644
--- a/spec/unit/interface/file_spec.rb
+++ b/spec/unit/interface/file_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/file'
-describe Puppet::Interface::Indirector.interface(:file) do
+describe Puppet::Interface.define(:file, '0.0.1') do
end
diff --git a/spec/unit/interface/indirector_spec.rb b/spec/unit/interface/indirector_spec.rb
index 0eb7a9a4f..b14058eca 100644
--- a/spec/unit/interface/indirector_spec.rb
+++ b/spec/unit/interface/indirector_spec.rb
@@ -5,7 +5,7 @@ require 'puppet/interface/indirector'
describe Puppet::Interface::Indirector do
before do
- @instance = Puppet::Interface::Indirector.new(:test)
+ @instance = Puppet::Interface::Indirector.new(:test, :version => '0.0.1')
@indirection = stub 'indirection', :name => :stub_indirection
@@ -24,7 +24,7 @@ describe Puppet::Interface::Indirector do
it "should be able to determine its indirection" do
# Loading actions here an get, um, complicated
Puppet::Interface.stubs(:load_actions)
- Puppet::Interface::Indirector.new(:catalog).indirection.should equal(Puppet::Resource::Catalog.indirection)
+ Puppet::Interface::Indirector.new(:catalog, :version => '0.0.1').indirection.should equal(Puppet::Resource::Catalog.indirection)
end
end
diff --git a/spec/unit/interface/interface_collection_spec.rb b/spec/unit/interface/interface_collection_spec.rb
index 42a0f2490..193d31b1e 100644
--- a/spec/unit/interface/interface_collection_spec.rb
+++ b/spec/unit/interface/interface_collection_spec.rb
@@ -1,20 +1,18 @@
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+#!/usr/bin/env ruby
-require 'puppet/interface/interface_collection'
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
describe Puppet::Interface::InterfaceCollection do
- # This is global state that other tests depend on, so we have to save and
- # restore it
before :all do
- @saved_interfaces = subject.instance_variable_get("@interfaces").dup
+ @interfaces = subject.instance_variable_get("@interfaces").dup
end
before :each do
- subject.instance_variable_set("@interfaces", {})
+ subject.instance_variable_get("@interfaces").clear
end
after :all do
- subject.instance_variable_set("@interfaces", @saved_interfaces)
+ subject.instance_variable_set("@interfaces", @interfaces)
end
describe "::interfaces" do
@@ -22,56 +20,56 @@ describe Puppet::Interface::InterfaceCollection do
describe "::[]" do
before :each do
- subject.instance_variable_set("@interfaces", {:foo => 10})
+ subject.instance_variable_get("@interfaces")[:foo]['0.0.1'] = 10
end
it "should return the interface with the given name" do
- subject["foo"].should == 10
+ subject["foo", '0.0.1'].should == 10
end
it "should attempt to load the interface if it isn't found" do
- subject.expects(:require).with('puppet/interface/bar')
- subject["bar"]
+ subject.expects(:require).with('puppet/interface/v0.0.1/bar')
+ subject["bar", '0.0.1']
end
end
describe "::interface?" do
before :each do
- subject.instance_variable_set("@interfaces", {:foo => 10})
+ subject.instance_variable_get("@interfaces")[:foo]['0.0.1'] = 10
end
it "should return true if the interface specified is registered" do
- subject.interface?("foo").should == true
+ subject.interface?("foo", '0.0.1').should == true
end
it "should attempt to require the interface if it is not registered" do
- subject.expects(:require).with('puppet/interface/bar')
- subject.interface?("bar")
+ subject.expects(:require).with('puppet/interface/v0.0.1/bar')
+ subject.interface?("bar", '0.0.1')
end
it "should return true if requiring the interface registered it" do
subject.stubs(:require).with do
- subject.instance_variable_set("@interfaces", {:bar => 20})
+ subject.instance_variable_get("@interfaces")[:bar]['0.0.1'] = 20
end
- subject.interface?("bar").should == true
+ subject.interface?("bar", '0.0.1').should == true
end
it "should return false if the interface is not registered" do
subject.stubs(:require).returns(true)
- subject.interface?("bar").should == false
+ subject.interface?("bar", '0.0.1').should == false
end
it "should return false if there is a LoadError requiring the interface" do
subject.stubs(:require).raises(LoadError)
- subject.interface?("bar").should == false
+ subject.interface?("bar", '0.0.1').should == false
end
end
describe "::register" do
it "should store the interface by name" do
- interface = Puppet::Interface.new(:my_interface)
+ interface = Puppet::Interface.new(:my_interface, :version => '0.0.1')
subject.register(interface)
- subject.instance_variable_get("@interfaces").should == {:my_interface => interface}
+ subject.instance_variable_get("@interfaces").should == {:my_interface => {'0.0.1' => interface}}
end
end
diff --git a/spec/unit/interface/key_spec.rb b/spec/unit/interface/key_spec.rb
index 4b331d169..519497808 100644
--- a/spec/unit/interface/key_spec.rb
+++ b/spec/unit/interface/key_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/key'
-describe Puppet::Interface::Indirector.interface(:key) do
+describe Puppet::Interface.define(:key, '0.0.1') do
end
diff --git a/spec/unit/interface/node_spec.rb b/spec/unit/interface/node_spec.rb
index b1b4ad421..91914c3ae 100644
--- a/spec/unit/interface/node_spec.rb
+++ b/spec/unit/interface/node_spec.rb
@@ -1,9 +1,8 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/node'
-describe Puppet::Interface::Indirector.interface(:node) do
+describe Puppet::Interface.define(:node, '0.0.1') do
it "should set its default format to :yaml" do
subject.default_format.should == :yaml
end
diff --git a/spec/unit/interface/report_spec.rb b/spec/unit/interface/report_spec.rb
index c424880a9..23855db09 100644
--- a/spec/unit/interface/report_spec.rb
+++ b/spec/unit/interface/report_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/report'
-describe Puppet::Interface::Indirector.interface(:report) do
+describe Puppet::Interface.define(:report, '0.0.1') do
end
diff --git a/spec/unit/interface/resource_spec.rb b/spec/unit/interface/resource_spec.rb
index aab2753b1..408be250c 100644
--- a/spec/unit/interface/resource_spec.rb
+++ b/spec/unit/interface/resource_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/resource'
-describe Puppet::Interface::Indirector.interface(:resource) do
+describe Puppet::Interface.define(:resource, '0.0.1') do
end
diff --git a/spec/unit/interface/resource_type_spec.rb b/spec/unit/interface/resource_type_spec.rb
index 6e973c98b..860be282c 100644
--- a/spec/unit/interface/resource_type_spec.rb
+++ b/spec/unit/interface/resource_type_spec.rb
@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/interface/resource_type'
-describe Puppet::Interface::Indirector.interface(:resource_type) do
+describe Puppet::Interface.define(:resource_type, '0.0.1') do
end