summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-04-07 14:20:35 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-04-07 15:52:04 -0700
commit8d144d0bf5116c5f04522f2b4cd75699f6480f8e (patch)
treed1f0a58fc106b04c9149782b56b0736394ef931b /spec/unit/application
parent5592034fdb8bf3a72ab3133d69443490f9ad7b78 (diff)
downloadpuppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.tar.gz
puppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.tar.xz
puppet-8d144d0bf5116c5f04522f2b4cd75699f6480f8e.zip
(#7012) Update references in code to use face(s)
The codebase is now using the new name, faces, uniformly to reference the objects contained. All tests pass.
Diffstat (limited to 'spec/unit/application')
-rwxr-xr-xspec/unit/application/certificate_spec.rb7
-rwxr-xr-xspec/unit/application/config_spec.rb4
-rwxr-xr-xspec/unit/application/faces_base_spec.rb32
-rwxr-xr-xspec/unit/application/faces_spec.rb6
-rwxr-xr-xspec/unit/application/indirection_base_spec.rb8
5 files changed, 27 insertions, 30 deletions
diff --git a/spec/unit/application/certificate_spec.rb b/spec/unit/application/certificate_spec.rb
index 3d2215ded..6153d9538 100755
--- a/spec/unit/application/certificate_spec.rb
+++ b/spec/unit/application/certificate_spec.rb
@@ -1,12 +1,9 @@
-#!/usr/bin/env ruby
-
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'puppet/application/certificate'
describe Puppet::Application::Certificate do
it "should have a 'ca-location' option" do
- # REVISIT: This is delegated from the string, and we will have a test
- # there, so is this actually a valuable test?
+ # REVISIT: This is delegated from the face, and we will have a test there,
+ # so is this actually a valuable test? --daniel 2011-04-07
subject.command_line.stubs(:args).returns %w{list}
subject.preinit
subject.should respond_to(:handle_ca_location)
diff --git a/spec/unit/application/config_spec.rb b/spec/unit/application/config_spec.rb
index a45adc8d3..066df6a51 100755
--- a/spec/unit/application/config_spec.rb
+++ b/spec/unit/application/config_spec.rb
@@ -4,7 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'puppet/application/config'
describe Puppet::Application::Config do
- it "should be a subclass of Puppet::Application::StringBase" do
- Puppet::Application::Config.superclass.should equal(Puppet::Application::StringBase)
+ it "should be a subclass of Puppet::Application::FacesBase" do
+ Puppet::Application::Config.superclass.should equal(Puppet::Application::FacesBase)
end
end
diff --git a/spec/unit/application/faces_base_spec.rb b/spec/unit/application/faces_base_spec.rb
index 3f8ae73b6..6d8815f44 100755
--- a/spec/unit/application/faces_base_spec.rb
+++ b/spec/unit/application/faces_base_spec.rb
@@ -1,22 +1,22 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/application/string_base'
+require 'puppet/application/faces_base'
require 'tmpdir'
-class Puppet::Application::StringBase::Basetest < Puppet::Application::StringBase
+class Puppet::Application::FacesBase::Basetest < Puppet::Application::FacesBase
end
-describe Puppet::Application::StringBase do
+describe Puppet::Application::FacesBase do
before :all do
@dir = Dir.mktmpdir
$LOAD_PATH.push(@dir)
- FileUtils.mkdir_p(File.join @dir, 'puppet', 'string')
- File.open(File.join(@dir, 'puppet', 'string', 'basetest.rb'), 'w') do |f|
- f.puts "Puppet::String.define(:basetest, '0.0.1')"
+ FileUtils.mkdir_p(File.join @dir, 'puppet', 'faces')
+ File.open(File.join(@dir, 'puppet', 'faces', 'basetest.rb'), 'w') do |f|
+ f.puts "Puppet::Faces.define(:basetest, '0.0.1')"
end
- Puppet::String.define(:basetest, '0.0.1') do
+ Puppet::Faces.define(:basetest, '0.0.1') do
option("--[no-]boolean")
option("--mandatory MANDATORY")
option("--optional [OPTIONAL]")
@@ -34,7 +34,7 @@ describe Puppet::Application::StringBase do
end
let :app do
- app = Puppet::Application::StringBase::Basetest.new
+ app = Puppet::Application::FacesBase::Basetest.new
app.stubs(:exit)
app.stubs(:puts)
app.command_line.stubs(:subcommand_name).returns 'subcommand'
@@ -63,11 +63,11 @@ describe Puppet::Application::StringBase do
app.preinit
end
- it "should set the string based on the type" do
- app.string.name.should == :basetest
+ it "should set the faces based on the type" do
+ app.face.name.should == :basetest
end
- it "should set the format based on the string default" do
+ it "should set the format based on the faces default" do
app.format.should == :pson
end
@@ -104,7 +104,7 @@ describe Puppet::Application::StringBase do
app.command_line.stubs(:args).returns %w{foo --bar}
app.preinit
app.action.name.should == :foo
- app.string.should_not be_option :bar
+ app.face.should_not be_option :bar
app.action.should_not be_option :bar
end
@@ -166,14 +166,14 @@ describe Puppet::Application::StringBase do
describe "#main" do
before do
- app.string = Puppet::String[:basetest, '0.0.1']
- app.action = app.string.get_action(:foo)
+ app.face = Puppet::Faces[: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 string" do
- app.string.expects(:foo).with(*app.arguments)
+ it "should send the specified verb and name to the faces" 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 13af0a546..d945c40b5 100755
--- a/spec/unit/application/faces_spec.rb
+++ b/spec/unit/application/faces_spec.rb
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-require 'puppet/application/string'
+require 'puppet/application/faces'
-describe Puppet::Application::String do
+describe Puppet::Application::Faces do
it "should be an application" do
- Puppet::Application::String.superclass.should equal(Puppet::Application)
+ Puppet::Application::Faces.superclass.should equal(Puppet::Application)
end
end
diff --git a/spec/unit/application/indirection_base_spec.rb b/spec/unit/application/indirection_base_spec.rb
index 66b3009fb..a73cf4fca 100755
--- a/spec/unit/application/indirection_base_spec.rb
+++ b/spec/unit/application/indirection_base_spec.rb
@@ -2,19 +2,19 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
require 'puppet/application/indirection_base'
-require 'puppet/string/indirector'
+require 'puppet/faces/indirector'
########################################################################
# Stub for testing; the names are critical, sadly. --daniel 2011-03-30
class Puppet::Application::TestIndirection < Puppet::Application::IndirectionBase
end
-string = Puppet::String::Indirector.define(:testindirection, '0.0.1') do
+face = Puppet::Faces::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
-string.version = :current
-Puppet::String.register(string)
+face.version = :current
+Puppet::Faces.register(face)
########################################################################