summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-13 00:17:57 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-13 00:17:57 -0700
commit4dd6a77481400b7eeac3377267d092d4c6d22da3 (patch)
treef95d292596144832805a9b57a55bc440f7cfaa43 /spec
parent941c56a283265cdf5a951ecaae63580b60486c52 (diff)
(#7056) Use 'face' rather than 'faces' in the production code.
After some discussion we decided that most uses of the Puppet Face infrastructure were about single faces on their own, not about the collection, and so we were better referring to Puppet::Face[...] in code. This implements that by translating names and references in the Ruby code to the new, s-less, name.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/puppet/face/basetest.rb1
-rw-r--r--spec/lib/puppet/face/huzzah.rb (renamed from spec/lib/puppet/faces/huzzah.rb)4
-rw-r--r--spec/lib/puppet/faces/basetest.rb1
-rwxr-xr-xspec/unit/application/config_spec.rb4
-rwxr-xr-xspec/unit/application/face_base_spec.rb (renamed from spec/unit/application/faces_base_spec.rb)18
-rwxr-xr-xspec/unit/application/faces_spec.rb5
-rwxr-xr-xspec/unit/application/indirection_base_spec.rb6
-rwxr-xr-xspec/unit/face/catalog_spec.rb4
-rwxr-xr-xspec/unit/face/certificate_request_spec.rb3
-rwxr-xr-xspec/unit/face/certificate_revocation_list_spec.rb3
-rwxr-xr-xspec/unit/face/certificate_spec.rb (renamed from spec/unit/faces/certificate_spec.rb)4
-rwxr-xr-xspec/unit/face/config_spec.rb (renamed from spec/unit/faces/config_spec.rb)2
-rwxr-xr-xspec/unit/face/configurer_spec.rb (renamed from spec/unit/faces/configurer_spec.rb)2
-rwxr-xr-xspec/unit/face/facts_spec.rb (renamed from spec/unit/faces/facts_spec.rb)2
-rwxr-xr-xspec/unit/face/file_spec.rb (renamed from spec/unit/faces/file_spec.rb)2
-rw-r--r--spec/unit/face/help_spec.rb (renamed from spec/unit/faces/help_spec.rb)28
-rwxr-xr-xspec/unit/face/indirector_spec.rb (renamed from spec/unit/faces/indirector_spec.rb)18
-rwxr-xr-xspec/unit/face/key_spec.rb (renamed from spec/unit/faces/key_spec.rb)2
-rwxr-xr-xspec/unit/face/node_spec.rb (renamed from spec/unit/faces/node_spec.rb)2
-rwxr-xr-xspec/unit/face/report_spec.rb (renamed from spec/unit/faces/report_spec.rb)2
-rwxr-xr-xspec/unit/face/resource_spec.rb (renamed from spec/unit/faces/resource_spec.rb)2
-rwxr-xr-xspec/unit/face/resource_type_spec.rb3
-rw-r--r--spec/unit/face_spec.rb (renamed from spec/unit/faces_spec.rb)0
-rwxr-xr-xspec/unit/faces/catalog_spec.rb4
-rwxr-xr-xspec/unit/faces/certificate_request_spec.rb3
-rwxr-xr-xspec/unit/faces/certificate_revocation_list_spec.rb3
-rwxr-xr-xspec/unit/faces/resource_type_spec.rb3
-rwxr-xr-xspec/unit/interface/face_collection_spec.rb57
-rwxr-xr-xspec/unit/interface_spec.rb4
-rwxr-xr-xspec/unit/util/command_line_spec.rb2
30 files changed, 91 insertions, 103 deletions
diff --git a/spec/lib/puppet/face/basetest.rb b/spec/lib/puppet/face/basetest.rb
new file mode 100644
index 000000000..00616f74f
--- /dev/null
+++ b/spec/lib/puppet/face/basetest.rb
@@ -0,0 +1 @@
+Puppet::Face.define(:basetest, '0.0.1')
diff --git a/spec/lib/puppet/faces/huzzah.rb b/spec/lib/puppet/face/huzzah.rb
index e86730250..3428c6816 100644
--- a/spec/lib/puppet/faces/huzzah.rb
+++ b/spec/lib/puppet/face/huzzah.rb
@@ -1,5 +1,5 @@
-require 'puppet/faces'
-Puppet::Faces.define(:huzzah, '2.0.1') do
+require 'puppet/face'
+Puppet::Face.define(:huzzah, '2.0.1') do
summary "life is a thing for celebration"
action :bar do "is where beer comes from" end
end
diff --git a/spec/lib/puppet/faces/basetest.rb b/spec/lib/puppet/faces/basetest.rb
deleted file mode 100644
index d20c52b97..000000000
--- a/spec/lib/puppet/faces/basetest.rb
+++ /dev/null
@@ -1 +0,0 @@
-Puppet::Faces.define(:basetest, '0.0.1')
diff --git a/spec/unit/application/config_spec.rb b/spec/unit/application/config_spec.rb
index 0c1279630..fb224eac6 100755
--- a/spec/unit/application/config_spec.rb
+++ b/spec/unit/application/config_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
require 'puppet/application/config'
describe Puppet::Application::Config do
- it "should be a subclass of Puppet::Application::FacesBase" do
- Puppet::Application::Config.superclass.should equal(Puppet::Application::FacesBase)
+ it "should be a subclass of Puppet::Application::FaceBase" do
+ Puppet::Application::Config.superclass.should equal(Puppet::Application::FaceBase)
end
end
diff --git a/spec/unit/application/faces_base_spec.rb b/spec/unit/application/face_base_spec.rb
index 18bd30295..d09e00a32 100755
--- a/spec/unit/application/faces_base_spec.rb
+++ b/spec/unit/application/face_base_spec.rb
@@ -1,15 +1,15 @@
#!/usr/bin/env rspec
require 'spec_helper'
-require 'puppet/application/faces_base'
+require 'puppet/application/face_base'
require 'tmpdir'
-class Puppet::Application::FacesBase::Basetest < Puppet::Application::FacesBase
+class Puppet::Application::FaceBase::Basetest < Puppet::Application::FaceBase
end
-describe Puppet::Application::FacesBase do
+describe Puppet::Application::FaceBase do
before :all do
- Puppet::Faces.define(:basetest, '0.0.1') do
+ Puppet::Face.define(:basetest, '0.0.1') do
option("--[no-]boolean")
option("--mandatory MANDATORY")
option("--optional [OPTIONAL]")
@@ -22,7 +22,7 @@ describe Puppet::Application::FacesBase do
end
let :app do
- app = Puppet::Application::FacesBase::Basetest.new
+ app = Puppet::Application::FaceBase::Basetest.new
app.command_line.stubs(:subcommand_name).returns('subcommand')
Puppet::Util::Log.stubs(:newdestination)
app
@@ -57,11 +57,11 @@ describe Puppet::Application::FacesBase do
app.parse_options
end
- it "should set the faces based on the type" do
+ it "should set the face based on the type" do
app.face.name.should == :basetest
end
- it "should set the format based on the faces default" do
+ it "should set the format based on the face default" do
app.format.should == :pson
end
@@ -168,13 +168,13 @@ describe Puppet::Application::FacesBase do
before :each do
app.expects(:exit).with(0)
- app.face = Puppet::Faces[:basetest, '0.0.1']
+ app.face = Puppet::Face[:basetest, '0.0.1']
app.action = app.face.get_action(:foo)
app.format = :pson
app.arguments = ["myname", "myarg"]
end
- it "should send the specified verb and name to the faces" do
+ it "should send the specified verb and name to the face" do
app.face.expects(:foo).with(*app.arguments)
app.main
end
diff --git a/spec/unit/application/faces_spec.rb b/spec/unit/application/faces_spec.rb
index c4d15a297..9b6f073f5 100755
--- a/spec/unit/application/faces_spec.rb
+++ b/spec/unit/application/faces_spec.rb
@@ -9,8 +9,7 @@ describe Puppet::Application::Faces do
end
it "should always call 'list'" do
- faces = Puppet::Application::Faces.new
- faces.expects(:list)
- faces.main
+ subject.expects(:list)
+ subject.main
end
end
diff --git a/spec/unit/application/indirection_base_spec.rb b/spec/unit/application/indirection_base_spec.rb
index 98eb3a118..9aac36860 100755
--- a/spec/unit/application/indirection_base_spec.rb
+++ b/spec/unit/application/indirection_base_spec.rb
@@ -2,19 +2,19 @@
require 'spec_helper'
require 'puppet/application/indirection_base'
-require 'puppet/faces/indirector'
+require 'puppet/face/indirector'
########################################################################
# Stub for testing; the names are critical, sadly. --daniel 2011-03-30
class Puppet::Application::TestIndirection < Puppet::Application::IndirectionBase
end
-face = Puppet::Faces::Indirector.define(:testindirection, '0.0.1') do
+face = Puppet::Face::Indirector.define(:testindirection, '0.0.1') do
end
# REVISIT: This horror is required because we don't allow anything to be
# :current except for if it lives on, and is loaded from, disk. --daniel 2011-03-29
face.instance_variable_set('@version', :current)
-Puppet::Faces.register(face)
+Puppet::Face.register(face)
########################################################################
diff --git a/spec/unit/face/catalog_spec.rb b/spec/unit/face/catalog_spec.rb
new file mode 100755
index 000000000..28c2aa9be
--- /dev/null
+++ b/spec/unit/face/catalog_spec.rb
@@ -0,0 +1,4 @@
+require 'puppet/face'
+describe Puppet::Face[:catalog, '0.0.1'] do
+ it "should actually have some testing..."
+end
diff --git a/spec/unit/face/certificate_request_spec.rb b/spec/unit/face/certificate_request_spec.rb
new file mode 100755
index 000000000..a83a92df8
--- /dev/null
+++ b/spec/unit/face/certificate_request_spec.rb
@@ -0,0 +1,3 @@
+describe Puppet::Face[:certificate_request, '0.0.1'] do
+ it "should actually have some tests..."
+end
diff --git a/spec/unit/face/certificate_revocation_list_spec.rb b/spec/unit/face/certificate_revocation_list_spec.rb
new file mode 100755
index 000000000..22c0fa2bf
--- /dev/null
+++ b/spec/unit/face/certificate_revocation_list_spec.rb
@@ -0,0 +1,3 @@
+describe Puppet::Face[:certificate_revocation_list, '0.0.1'] do
+ it "should actually have some tests..."
+end
diff --git a/spec/unit/faces/certificate_spec.rb b/spec/unit/face/certificate_spec.rb
index ba264f967..dbcc888ad 100755
--- a/spec/unit/faces/certificate_spec.rb
+++ b/spec/unit/face/certificate_spec.rb
@@ -1,12 +1,12 @@
require 'puppet/ssl/host'
-describe Puppet::Faces[:certificate, '0.0.1'] do
+describe Puppet::Face[:certificate, '0.0.1'] do
it "should have a ca-location option" do
subject.should be_option :ca_location
end
it "should set the ca location when invoked" do
- pending "#6983: This is broken in the actual faces..."
+ pending "#6983: This is broken in the actual face..."
Puppet::SSL::Host.expects(:ca_location=).with(:foo)
Puppet::SSL::Host.indirection.expects(:save)
subject.sign :ca_location => :foo
diff --git a/spec/unit/faces/config_spec.rb b/spec/unit/face/config_spec.rb
index b71995e9f..3657b9abd 100755
--- a/spec/unit/faces/config_spec.rb
+++ b/spec/unit/face/config_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Puppet::Faces[:config, '0.0.1'] do
+describe Puppet::Face[: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/faces/configurer_spec.rb b/spec/unit/face/configurer_spec.rb
index 6982c00ae..a404c926f 100755
--- a/spec/unit/faces/configurer_spec.rb
+++ b/spec/unit/face/configurer_spec.rb
@@ -4,7 +4,7 @@ require 'spec_helper'
require 'puppet/indirector/catalog/rest'
require 'tempfile'
-describe Puppet::Faces[:configurer, '0.0.1'] do
+describe Puppet::Face[:configurer, '0.0.1'] do
describe "#synchronize" do
it "should retrieve and apply a catalog and return a report" do
pending "REVISIT: 2.7 changes broke this, and we want the merge published"
diff --git a/spec/unit/faces/facts_spec.rb b/spec/unit/face/facts_spec.rb
index 46496a839..f574ac741 100755
--- a/spec/unit/faces/facts_spec.rb
+++ b/spec/unit/face/facts_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Puppet::Faces[:facts, '0.0.1'] do
+describe Puppet::Face[:facts, '0.0.1'] do
it "should define an 'upload' fact" do
subject.should be_action(:upload)
end
diff --git a/spec/unit/faces/file_spec.rb b/spec/unit/face/file_spec.rb
index fcb52c67e..97e8bcc08 100755
--- a/spec/unit/faces/file_spec.rb
+++ b/spec/unit/face/file_spec.rb
@@ -1,3 +1,3 @@
-describe Puppet::Faces[:file, '0.0.1'] do
+describe Puppet::Face[:file, '0.0.1'] do
it "should actually have some tests..."
end
diff --git a/spec/unit/faces/help_spec.rb b/spec/unit/face/help_spec.rb
index cd74a5bf1..e67f29e07 100644
--- a/spec/unit/faces/help_spec.rb
+++ b/spec/unit/face/help_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-require 'puppet/faces/help'
+require 'puppet/face/help'
-describe Puppet::Faces[:help, '0.0.1'] do
+describe Puppet::Face[:help, '0.0.1'] do
it "should have a help action" do
subject.should be_action :help
end
@@ -38,41 +38,41 @@ describe Puppet::Faces[:help, '0.0.1'] do
end
it "should find a face by version" do
- face = Puppet::Faces[:huzzah, :current]
+ face = Puppet::Face[:huzzah, :current]
subject.help(:huzzah, :version => face.version).
should == subject.help(:huzzah, :version => :current)
end
context "when listing subcommands" do
- subject { Puppet::Faces[:help, :current].help }
+ subject { Puppet::Face[:help, :current].help }
# Check a precondition for the next block; if this fails you have
- # something odd in your set of faces, and we skip testing things that
+ # something odd in your set of face, and we skip testing things that
# matter. --daniel 2011-04-10
it "should have at least one face with a summary" do
- Puppet::Faces.faces.should be_any do |name|
- Puppet::Faces[name, :current].summary
+ Puppet::Face.faces.should be_any do |name|
+ Puppet::Face[name, :current].summary
end
end
- Puppet::Faces.faces.each do |name|
- face = Puppet::Faces[name, :current]
+ Puppet::Face.faces.each do |name|
+ face = Puppet::Face[name, :current]
summary = face.summary
it { should =~ %r{ #{name} } }
it { should =~ %r{ #{name} +#{summary}} } if summary
end
- Puppet::Faces[:help, :current].legacy_applications.each do |appname|
+ Puppet::Face[:help, :current].legacy_applications.each do |appname|
it { should =~ %r{ #{appname} } }
- summary = Puppet::Faces[:help, :current].horribly_extract_summary_from(appname)
+ summary = Puppet::Face[:help, :current].horribly_extract_summary_from(appname)
summary and it { should =~ %r{ #{summary}\b} }
end
end
context "#legacy_applications" do
- subject { Puppet::Faces[:help, :current].legacy_applications }
+ subject { Puppet::Face[:help, :current].legacy_applications }
# If we don't, these tests are ... less than useful, because they assume
# it. When this breaks you should consider ditching the entire feature
@@ -83,13 +83,13 @@ describe Puppet::Faces[:help, '0.0.1'] do
# bug that caused these to be listed is annoyingly subtle and has a nasty
# fix, so better to have a "fail if you do something daft" trigger in
# place here, I think. --daniel 2011-04-11
- %w{faces_base indirection_base}.each do |name|
+ %w{face_base indirection_base}.each do |name|
it { should_not include name }
end
end
context "help for legacy applications" do
- subject { Puppet::Faces[:help, :current] }
+ subject { Puppet::Face[:help, :current] }
let :appname do subject.legacy_applications.first end
# This test is purposely generic, so that as we eliminate legacy commands
diff --git a/spec/unit/faces/indirector_spec.rb b/spec/unit/face/indirector_spec.rb
index c1aed9617..269e05543 100755
--- a/spec/unit/faces/indirector_spec.rb
+++ b/spec/unit/face/indirector_spec.rb
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby
require 'spec_helper'
-require 'puppet/faces/indirector'
+require 'puppet/face/indirector'
-describe Puppet::Faces::Indirector do
+describe Puppet::Face::Indirector do
subject do
- instance = Puppet::Faces::Indirector.new(:test, '0.0.1')
+ instance = Puppet::Face::Indirector.new(:test, '0.0.1')
indirection = stub('indirection',
:name => :stub_indirection,
:reset_terminus_class => nil)
@@ -14,24 +14,24 @@ describe Puppet::Faces::Indirector do
end
it "should be able to return a list of indirections" do
- Puppet::Faces::Indirector.indirections.should be_include("catalog")
+ Puppet::Face::Indirector.indirections.should be_include("catalog")
end
it "should be able to return a list of terminuses for a given indirection" do
- Puppet::Faces::Indirector.terminus_classes(:catalog).should be_include("compiler")
+ Puppet::Face::Indirector.terminus_classes(:catalog).should be_include("compiler")
end
describe "as an instance" do
it "should be able to determine its indirection" do
# Loading actions here an get, um, complicated
- Puppet::Faces.stubs(:load_actions)
- Puppet::Faces::Indirector.new(:catalog, '0.0.1').indirection.should equal(Puppet::Resource::Catalog.indirection)
+ Puppet::Face.stubs(:load_actions)
+ Puppet::Face::Indirector.new(:catalog, '0.0.1').indirection.should equal(Puppet::Resource::Catalog.indirection)
end
end
[:find, :search, :save, :destroy].each do |method|
it "should define a '#{method}' action" do
- Puppet::Faces::Indirector.should be_action(method)
+ Puppet::Face::Indirector.should be_action(method)
end
it "should call the indirection method with options when the '#{method}' action is invoked" do
@@ -55,6 +55,6 @@ describe Puppet::Faces::Indirector do
end
it "should define a class-level 'info' action" do
- Puppet::Faces::Indirector.should be_action(:info)
+ Puppet::Face::Indirector.should be_action(:info)
end
end
diff --git a/spec/unit/faces/key_spec.rb b/spec/unit/face/key_spec.rb
index 9b7a58706..10d664790 100755
--- a/spec/unit/faces/key_spec.rb
+++ b/spec/unit/face/key_spec.rb
@@ -1,3 +1,3 @@
-describe Puppet::Faces[:key, '0.0.1'] do
+describe Puppet::Face[:key, '0.0.1'] do
it "should actually have some tests..."
end
diff --git a/spec/unit/faces/node_spec.rb b/spec/unit/face/node_spec.rb
index c6ed71f59..d27f41b56 100755
--- a/spec/unit/faces/node_spec.rb
+++ b/spec/unit/face/node_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Puppet::Faces[:node, '0.0.1'] do
+describe Puppet::Face[: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/faces/report_spec.rb b/spec/unit/face/report_spec.rb
index 30897d5e7..b1b28167e 100755
--- a/spec/unit/faces/report_spec.rb
+++ b/spec/unit/face/report_spec.rb
@@ -1,3 +1,3 @@
-describe Puppet::Faces[:report, '0.0.1'] do
+describe Puppet::Face[:report, '0.0.1'] do
it "should actually have some tests..."
end
diff --git a/spec/unit/faces/resource_spec.rb b/spec/unit/face/resource_spec.rb
index e3f2e1c62..084e2a6a9 100755
--- a/spec/unit/faces/resource_spec.rb
+++ b/spec/unit/face/resource_spec.rb
@@ -1,3 +1,3 @@
-describe Puppet::Faces[:resource, '0.0.1'] do
+describe Puppet::Face[:resource, '0.0.1'] do
it "should actually have some tests..."
end
diff --git a/spec/unit/face/resource_type_spec.rb b/spec/unit/face/resource_type_spec.rb
new file mode 100755
index 000000000..2adaedca1
--- /dev/null
+++ b/spec/unit/face/resource_type_spec.rb
@@ -0,0 +1,3 @@
+describe Puppet::Face[:resource_type, '0.0.1'] do
+ it "should actually have some tests..."
+end
diff --git a/spec/unit/faces_spec.rb b/spec/unit/face_spec.rb
index b6c49d917..b6c49d917 100644
--- a/spec/unit/faces_spec.rb
+++ b/spec/unit/face_spec.rb
diff --git a/spec/unit/faces/catalog_spec.rb b/spec/unit/faces/catalog_spec.rb
deleted file mode 100755
index e0a771d10..000000000
--- a/spec/unit/faces/catalog_spec.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'puppet/faces'
-describe Puppet::Faces[:catalog, '0.0.1'] do
- it "should actually have some testing..."
-end
diff --git a/spec/unit/faces/certificate_request_spec.rb b/spec/unit/faces/certificate_request_spec.rb
deleted file mode 100755
index 1a71a8379..000000000
--- a/spec/unit/faces/certificate_request_spec.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe Puppet::Faces[:certificate_request, '0.0.1'] do
- it "should actually have some tests..."
-end
diff --git a/spec/unit/faces/certificate_revocation_list_spec.rb b/spec/unit/faces/certificate_revocation_list_spec.rb
deleted file mode 100755
index 4f41edef6..000000000
--- a/spec/unit/faces/certificate_revocation_list_spec.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe Puppet::Faces[:certificate_revocation_list, '0.0.1'] do
- it "should actually have some tests..."
-end
diff --git a/spec/unit/faces/resource_type_spec.rb b/spec/unit/faces/resource_type_spec.rb
deleted file mode 100755
index fcbf07520..000000000
--- a/spec/unit/faces/resource_type_spec.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-describe Puppet::Faces[:resource_type, '0.0.1'] do
- it "should actually have some tests..."
-end
diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb
index 752871035..6ba35b4b2 100755
--- a/spec/unit/interface/face_collection_spec.rb
+++ b/spec/unit/interface/face_collection_spec.rb
@@ -15,7 +15,7 @@ describe Puppet::Interface::FaceCollection do
before :each do
@original_faces = subject.instance_variable_get("@faces").dup
@original_required = $".dup
- $".delete_if do |path| path =~ %r{/faces/.*\.rb$} end
+ $".delete_if do |path| path =~ %r{/face/.*\.rb$} end
subject.instance_variable_get("@faces").clear
end
@@ -59,82 +59,71 @@ describe Puppet::Interface::FaceCollection do
subject.instance_variable_get("@faces")[:foo]['0.0.1'] = 10
end
- before :each do
- @dir = Dir.mktmpdir
- @lib = FileUtils.mkdir_p(File.join @dir, 'puppet', 'faces')
- $LOAD_PATH.push(@dir)
- end
-
- after :each do
- FileUtils.remove_entry_secure @dir
- $LOAD_PATH.pop
- end
-
- it "should return the faces with the given name" do
+ it "should return the face with the given name" do
subject["foo", '0.0.1'].should == 10
end
- it "should attempt to load the faces if it isn't found" do
- subject.expects(:require).with('puppet/faces/bar')
+ it "should attempt to load the face if it isn't found" do
+ subject.expects(:require).with('puppet/face/bar')
subject["bar", '0.0.1']
end
- it "should attempt to load the default faces for the specified version :current" do
- subject.expects(:require).with('puppet/faces/fozzie')
+ it "should attempt to load the default face for the specified version :current" do
+ subject.expects(:require).with('puppet/face/fozzie')
subject['fozzie', :current]
end
end
describe "::face?" do
- it "should return true if the faces specified is registered" do
+ it "should return true if the face specified is registered" do
subject.instance_variable_get("@faces")[:foo]['0.0.1'] = 10
subject.face?("foo", '0.0.1').should == true
end
- it "should attempt to require the faces if it is not registered" do
+ it "should attempt to require the face if it is not registered" do
subject.expects(:require).with do |file|
subject.instance_variable_get("@faces")[:bar]['0.0.1'] = true
- file == 'puppet/faces/bar'
+ file == 'puppet/face/bar'
end
subject.face?("bar", '0.0.1').should == true
end
- it "should return true if requiring the faces registered it" do
+ it "should return true if requiring the face registered it" do
subject.stubs(:require).with do
subject.instance_variable_get("@faces")[:bar]['0.0.1'] = 20
end
end
- it "should return false if the faces is not registered" do
+ it "should return false if the face is not registered" do
subject.stubs(:require).returns(true)
subject.face?("bar", '0.0.1').should be_false
end
- it "should return false if the faces file itself is missing" do
+ it "should return false if the face file itself is missing" do
subject.stubs(:require).
- raises(LoadError, 'no such file to load -- puppet/faces/bar')
+ raises(LoadError, 'no such file to load -- puppet/face/bar')
subject.face?("bar", '0.0.1').should be_false
end
it "should register the version loaded by `:current` as `:current`" do
subject.expects(:require).with do |file|
- subject.instance_variable_get("@faces")[:huzzah]['2.0.1'] = :huzzah_faces
- file == 'puppet/faces/huzzah'
+ subject.instance_variable_get("@faces")[:huzzah]['2.0.1'] = :huzzah_face
+ file == 'puppet/face/huzzah'
end
subject.face?("huzzah", :current)
- subject.instance_variable_get("@faces")[:huzzah][:current].should == :huzzah_faces
+ subject.instance_variable_get("@faces")[:huzzah][:current].should == :huzzah_face
end
context "with something on disk" do
- it "should register the version loaded from `puppet/faces/{name}` as `:current`" do
+ it "should register the version loaded from `puppet/face/{name}` as `:current`" do
subject.should be_face "huzzah", '2.0.1'
subject.should be_face "huzzah", :current
- Puppet::Faces[:huzzah, '2.0.1'].should == Puppet::Faces[:huzzah, :current]
+ Puppet::Face[:huzzah, '2.0.1'].should == Puppet::Face[:huzzah, :current]
end
it "should index :current when the code was pre-required" do
subject.instance_variable_get("@faces")[:huzzah].should_not be_key :current
- require 'puppet/faces/huzzah'
+ require 'puppet/face/huzzah'
subject.face?(:huzzah, :current).should be_true
end
end
@@ -146,10 +135,10 @@ describe Puppet::Interface::FaceCollection do
end
describe "::register" do
- it "should store the faces by name" do
- faces = Puppet::Faces.new(:my_faces, '0.0.1')
- subject.register(faces)
- subject.instance_variable_get("@faces").should == {:my_faces => {'0.0.1' => faces}}
+ it "should store the face by name" do
+ face = Puppet::Face.new(:my_face, '0.0.1')
+ subject.register(face)
+ subject.instance_variable_get("@faces").should == {:my_face => {'0.0.1' => face}}
end
end
diff --git a/spec/unit/interface_spec.rb b/spec/unit/interface_spec.rb
index 7e6b7de77..2365d5cac 100755
--- a/spec/unit/interface_spec.rb
+++ b/spec/unit/interface_spec.rb
@@ -1,5 +1,5 @@
require 'spec_helper'
-require 'puppet/faces'
+require 'puppet/face'
require 'puppet/interface'
describe Puppet::Interface do
@@ -116,7 +116,7 @@ describe Puppet::Interface do
it "should try to require faces that are not known" do
pending "mocking require causes random stack overflow"
- subject::FaceCollection.expects(:require).with "puppet/faces/foo"
+ subject::FaceCollection.expects(:require).with "puppet/face/foo"
subject[:foo, '0.0.1']
end
diff --git a/spec/unit/util/command_line_spec.rb b/spec/unit/util/command_line_spec.rb
index 6cf90475b..b0c2a85ae 100755
--- a/spec/unit/util/command_line_spec.rb
+++ b/spec/unit/util/command_line_spec.rb
@@ -99,7 +99,7 @@ describe Puppet::Util::CommandLine do
Puppet::Util.expects(:which).with('puppet-whatever').returns(nil)
commandline.expects(:system).never
- text = Puppet::Faces[:help, :current].help
+ text = Puppet::Face[:help, :current].help
commandline.expects(:puts).with { |x| x =~ /Unknown Puppet subcommand/ }
commandline.expects(:puts).with text