summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface_spec.rb
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-03-18 20:53:00 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-03-21 11:36:44 -0700
commitb187e071ac1b334878498d52ee6c18f8c0e6a5d9 (patch)
tree119e82d292fd730ee6c1126bea27ca77f7a332a6 /spec/unit/interface_spec.rb
parentf67e7fa39479751a7c5268bd32e503e35602ce4f (diff)
downloadpuppet-b187e071ac1b334878498d52ee6c18f8c0e6a5d9.tar.gz
puppet-b187e071ac1b334878498d52ee6c18f8c0e6a5d9.tar.xz
puppet-b187e071ac1b334878498d52ee6c18f8c0e6a5d9.zip
(#6786) Removing the #interface method.
Since constants are already being defined for each interface, the #interface method does little but provide another way to access the same data. Reviewed-By: Nick Lewis
Diffstat (limited to 'spec/unit/interface_spec.rb')
-rw-r--r--spec/unit/interface_spec.rb22
1 files changed, 9 insertions, 13 deletions
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 8799d6b74..4b6fd117f 100644
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -14,7 +14,9 @@ describe Puppet::Interface do
end
it "should register itself" do
- Puppet::Interface.expects(:register_interface).with { |name, inst| name == :me and inst.is_a?(Puppet::Interface) }
+ Puppet::Interface.expects(:register_interface).with do |name, inst|
+ name == :me and inst.is_a?(Puppet::Interface)
+ end
Puppet::Interface.new(:me)
end
@@ -46,6 +48,7 @@ describe Puppet::Interface do
Puppet::Interface.new(:me).default_format.should == :pson
end
+ # Why?
it "should create a class-level autoloader" do
Puppet::Interface.autoloader.should be_instance_of(Puppet::Util::Autoload)
end
@@ -54,14 +57,6 @@ describe Puppet::Interface do
Puppet::Interface.new(:me, :verb => "foo").verb.should == "foo"
end
- it "should be able to register and return interfaces" do
- $stderr.stubs(:puts)
- face = Puppet::Interface.new(:me)
- Puppet::Interface.unload_interface(:me) # to remove from the initial registration
- Puppet::Interface.register_interface(:me, face)
- Puppet::Interface.interface(:me).should equal(face)
- end
-
it "should create an associated constant when registering an interface" do
$stderr.stubs(:puts)
face = Puppet::Interface.new(:me)
@@ -70,29 +65,30 @@ describe Puppet::Interface do
Puppet::Interface::Me.should equal(face)
end
+ # Why is unloading interfaces important?
it "should be able to unload interfaces" do
$stderr.stubs(:puts)
face = Puppet::Interface.new(:me)
Puppet::Interface.unload_interface(:me)
- Puppet::Interface.interface(:me).should be_nil
+ Puppet::Interface.const_defined?(:Me).should be_false
end
it "should remove the associated constant when an interface is unregistered" do
$stderr.stubs(:puts)
face = Puppet::Interface.new(:me)
Puppet::Interface.unload_interface(:me)
- lambda { Puppet::Interface.const_get("Me") }.should raise_error(NameError)
+ Puppet::Interface.const_defined?("Me").should be_false
end
it "should try to require interfaces that are not known" do
Puppet::Interface.expects(:require).with "puppet/interface/foo"
- Puppet::Interface.interface(:foo)
+ Puppet::Interface.const_get(:Foo)
end
it "should not fail when requiring an interface fails" do
$stderr.stubs(:puts)
Puppet::Interface.expects(:require).with("puppet/interface/foo").raises LoadError
- lambda { Puppet::Interface.interface(:foo) }.should_not raise_error
+ lambda { Puppet::Interface::Foo }.should_not raise_error
end
it "should be able to load all actions in all search paths"