diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-21 16:34:20 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-07-22 13:29:29 -0700 |
| commit | 2cd3bc47993fbd32a77ca9dfdd51353f2dfbcb58 (patch) | |
| tree | c38b1533e7221ee62325ea68d3cd10848dc8d9f2 /spec | |
| parent | 1e0655e6bdbc872014abdffa5deacb334616e826 (diff) | |
| download | puppet-2cd3bc47993fbd32a77ca9dfdd51353f2dfbcb58.tar.gz puppet-2cd3bc47993fbd32a77ca9dfdd51353f2dfbcb58.tar.xz puppet-2cd3bc47993fbd32a77ca9dfdd51353f2dfbcb58.zip | |
(#7184) Find actions bound to other versions of Faces.
When we first touch a Face, we load all the available Actions from disk.
Given they define themselves against a specific version of a Face, they are
automatically available tied to the correct version; this makes it trivially
possible to locate those on demand and return them.
Now, we have the ability to find and, consequently, invoke Actions on older
versions of Faces. We don't load enough context, though: the older face will
only have external Actions defined, not anything core.
Reviewed-By: Pieter van de Bruggen <pieter@puppetlabs.com>
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/puppet/face/huzzah/obsolete.rb | 6 | ||||
| -rwxr-xr-x | spec/unit/interface/face_collection_spec.rb | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/lib/puppet/face/huzzah/obsolete.rb b/spec/lib/puppet/face/huzzah/obsolete.rb new file mode 100644 index 000000000..1f717ea2f --- /dev/null +++ b/spec/lib/puppet/face/huzzah/obsolete.rb @@ -0,0 +1,6 @@ +Puppet::Face.define(:huzzah, '1.0.0') do + action :obsolete do + summary "This is an action on version 1.0.0 of the face" + when_invoked do |options| options end + end +end diff --git a/spec/unit/interface/face_collection_spec.rb b/spec/unit/interface/face_collection_spec.rb index 98887a778..8f9c349b6 100755 --- a/spec/unit/interface/face_collection_spec.rb +++ b/spec/unit/interface/face_collection_spec.rb @@ -97,6 +97,21 @@ describe Puppet::Interface::FaceCollection do end end + describe "::get_action_for_face" do + it "should return an action on the current face" do + Puppet::Face::FaceCollection.get_action_for_face(:huzzah, :bar, :current). + should be_an_instance_of Puppet::Interface::Action + end + + it "should return an action on an older version of a face" do + action = Puppet::Face::FaceCollection. + get_action_for_face(:huzzah, :obsolete, :current) + + action.should be_an_instance_of Puppet::Interface::Action + action.face.version.should == SemVer.new('1.0.0') + end + end + describe "::register" do it "should store the face by name" do face = Puppet::Face.new(:my_face, '0.0.1') |
