summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2011-02-22 17:13:52 -0800
committerLuke Kanies <luke@puppetlabs.com>2011-02-22 17:13:52 -0800
commitc2715c0f20d916de0284e2d161eb5de32e508244 (patch)
tree9a751a7f4256801026d73416546d17ae039ab7a1 /spec/unit/interface
parent7da0a26f1bd44ecfffe9f622ec9d560870506207 (diff)
downloadpuppet-c2715c0f20d916de0284e2d161eb5de32e508244.tar.gz
puppet-c2715c0f20d916de0284e2d161eb5de32e508244.tar.xz
puppet-c2715c0f20d916de0284e2d161eb5de32e508244.zip
Splitting the Application base class
We now have an indirection_base class along with interface_base. I've also added some basic tests for most of the interfaces. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'spec/unit/interface')
-rw-r--r--spec/unit/interface/catalog_spec.rb24
-rw-r--r--spec/unit/interface/certificate_request_spec.rb24
-rw-r--r--spec/unit/interface/certificate_revocation_list_spec.rb24
-rw-r--r--spec/unit/interface/certificate_spec.rb24
-rw-r--r--spec/unit/interface/file_spec.rb24
-rw-r--r--spec/unit/interface/indirector_spec.rb2
-rw-r--r--spec/unit/interface/key_spec.rb24
-rw-r--r--spec/unit/interface/node_spec.rb24
-rw-r--r--spec/unit/interface/report_spec.rb24
-rw-r--r--spec/unit/interface/resource_spec.rb24
-rw-r--r--spec/unit/interface/resource_type_spec.rb24
11 files changed, 240 insertions, 2 deletions
diff --git a/spec/unit/interface/catalog_spec.rb b/spec/unit/interface/catalog_spec.rb
new file mode 100644
index 000000000..8eb0040ff
--- /dev/null
+++ b/spec/unit/interface/catalog_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/catalog'
+
+describe Puppet::Interface.interface(:catalog) do
+ before do
+ @interface = Puppet::Interface.interface(:catalog)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'catalog' indirection" do
+ @interface.indirection.name.should == :catalog
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/certificate_request_spec.rb b/spec/unit/interface/certificate_request_spec.rb
new file mode 100644
index 000000000..8a613e5e5
--- /dev/null
+++ b/spec/unit/interface/certificate_request_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/certificate_request'
+
+describe Puppet::Interface.interface(:certificate_request) do
+ before do
+ @interface = Puppet::Interface.interface(:certificate_request)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'certificate_request' indirection" do
+ @interface.indirection.name.should == :certificate_request
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/certificate_revocation_list_spec.rb b/spec/unit/interface/certificate_revocation_list_spec.rb
new file mode 100644
index 000000000..8ee341bef
--- /dev/null
+++ b/spec/unit/interface/certificate_revocation_list_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/certificate_revocation_list'
+
+describe Puppet::Interface.interface(:certificate_revocation_list) do
+ before do
+ @interface = Puppet::Interface.interface(:certificate_revocation_list)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'certificate_revocation_list' indirection" do
+ @interface.indirection.name.should == :certificate_revocation_list
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/certificate_spec.rb b/spec/unit/interface/certificate_spec.rb
new file mode 100644
index 000000000..47ddcb52e
--- /dev/null
+++ b/spec/unit/interface/certificate_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/certificate'
+
+describe Puppet::Interface.interface(:certificate) do
+ before do
+ @interface = Puppet::Interface.interface(:certificate)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'certificate' indirection" do
+ @interface.indirection.name.should == :certificate
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/file_spec.rb b/spec/unit/interface/file_spec.rb
new file mode 100644
index 000000000..fc7accf0d
--- /dev/null
+++ b/spec/unit/interface/file_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/file'
+
+describe Puppet::Interface.interface(:file) do
+ before do
+ @interface = Puppet::Interface.interface(:file)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'file' indirection" do
+ @interface.indirection.name.should == :file_bucket_file
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/indirector_spec.rb b/spec/unit/interface/indirector_spec.rb
index 1e5ee3068..645c599b3 100644
--- a/spec/unit/interface/indirector_spec.rb
+++ b/spec/unit/interface/indirector_spec.rb
@@ -29,8 +29,6 @@ describe Puppet::Interface::Indirector do
end
describe "as an instance" do
- after { Puppet::Interface.unload_interface(:catalog) }
-
it "should be able to determine its indirection" do
# Loading actions here an get, um, complicated
Puppet::Interface.stubs(:load_actions)
diff --git a/spec/unit/interface/key_spec.rb b/spec/unit/interface/key_spec.rb
new file mode 100644
index 000000000..93a7c937c
--- /dev/null
+++ b/spec/unit/interface/key_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/key'
+
+describe Puppet::Interface.interface(:key) do
+ before do
+ @interface = Puppet::Interface.interface(:key)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'key' indirection" do
+ @interface.indirection.name.should == :key
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/node_spec.rb b/spec/unit/interface/node_spec.rb
new file mode 100644
index 000000000..afb609d2b
--- /dev/null
+++ b/spec/unit/interface/node_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/node'
+
+describe Puppet::Interface.interface(:node) do
+ before do
+ @interface = Puppet::Interface.interface(:node)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'node' indirection" do
+ @interface.indirection.name.should == :node
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/report_spec.rb b/spec/unit/interface/report_spec.rb
new file mode 100644
index 000000000..b5bee1a62
--- /dev/null
+++ b/spec/unit/interface/report_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/report'
+
+describe Puppet::Interface.interface(:report) do
+ before do
+ @interface = Puppet::Interface.interface(:report)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'report' indirection" do
+ @interface.indirection.name.should == :report
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/resource_spec.rb b/spec/unit/interface/resource_spec.rb
new file mode 100644
index 000000000..cad45b66b
--- /dev/null
+++ b/spec/unit/interface/resource_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/resource'
+
+describe Puppet::Interface.interface(:resource) do
+ before do
+ @interface = Puppet::Interface.interface(:resource)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'resource' indirection" do
+ @interface.indirection.name.should == :resource
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end
diff --git a/spec/unit/interface/resource_type_spec.rb b/spec/unit/interface/resource_type_spec.rb
new file mode 100644
index 000000000..6c437c475
--- /dev/null
+++ b/spec/unit/interface/resource_type_spec.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/env ruby
+
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+require 'puppet/interface/resource_type'
+
+describe Puppet::Interface.interface(:resource_type) do
+ before do
+ @interface = Puppet::Interface.interface(:resource_type)
+ end
+
+ it "should be a subclass of 'Indirection'" do
+ @interface.should be_instance_of(Puppet::Interface::Indirector)
+ end
+
+ it "should refer to the 'resource_type' indirection" do
+ @interface.indirection.name.should == :resource_type
+ end
+
+ [:find, :save, :search, :save].each do |method|
+ it "should have #{method} action defined" do
+ @interface.should be_action(method)
+ end
+ end
+end