summaryrefslogtreecommitdiffstats
path: root/spec/unit/interface
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/interface')
-rwxr-xr-xspec/unit/interface/action_builder_spec.rb11
-rwxr-xr-xspec/unit/interface/face_collection_spec.rb16
2 files changed, 22 insertions, 5 deletions
diff --git a/spec/unit/interface/action_builder_spec.rb b/spec/unit/interface/action_builder_spec.rb
index 7d2710942..666575605 100755
--- a/spec/unit/interface/action_builder_spec.rb
+++ b/spec/unit/interface/action_builder_spec.rb
@@ -55,5 +55,16 @@ describe Puppet::Interface::ActionBuilder do
action.should be_option :bar
end
end
+
+ context "inline documentation" do
+ let :face do Puppet::Interface.new(:inline_action_docs, '0.0.1') end
+
+ it "should set the summary" do
+ action = Puppet::Interface::ActionBuilder.build(face, :foo) do
+ summary "this is some text"
+ end
+ action.summary.should == "this is some text"
+ end
+ end
end
end
diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb
index b83bd50d3..752871035 100755
--- a/spec/unit/interface/face_collection_spec.rb
+++ b/spec/unit/interface/face_collection_spec.rb
@@ -8,9 +8,14 @@ describe Puppet::Interface::FaceCollection do
# To avoid cross-pollution we have to save and restore both the hash
# containing all the interface data, and the array used by require. Restoring
# both means that we don't leak side-effects across the code. --daniel 2011-04-06
+ #
+ # Worse luck, we *also* need to flush $" of anything defining a face,
+ # because otherwise we can cross-pollute from other test files and end up
+ # with no faces loaded, but the require value set true. --daniel 2011-04-10
before :each do
@original_faces = subject.instance_variable_get("@faces").dup
@original_required = $".dup
+ $".delete_if do |path| path =~ %r{/faces/.*\.rb$} end
subject.instance_variable_get("@faces").clear
end
@@ -75,18 +80,14 @@ describe Puppet::Interface::FaceCollection do
end
it "should attempt to load the default faces for the specified version :current" do
- subject.expects(:require).never # except...
subject.expects(:require).with('puppet/faces/fozzie')
subject['fozzie', :current]
end
end
describe "::face?" do
- before :each do
- subject.instance_variable_get("@faces")[:foo]['0.0.1'] = 10
- end
-
it "should return true if the faces specified is registered" do
+ subject.instance_variable_get("@faces")[:foo]['0.0.1'] = 10
subject.face?("foo", '0.0.1').should == true
end
@@ -137,6 +138,11 @@ describe Puppet::Interface::FaceCollection do
subject.face?(:huzzah, :current).should be_true
end
end
+
+ it "should not cause an invalid face to be enumerated later" do
+ subject.face?(:there_is_no_face, :current).should be_false
+ subject.faces.should_not include :there_is_no_face
+ end
end
describe "::register" do