diff options
| author | Dominic Maraglia <dmaraglia@gmail.com> | 2011-05-03 17:59:26 -0700 |
|---|---|---|
| committer | Dominic Maraglia <dmaraglia@gmail.com> | 2011-05-03 17:59:26 -0700 |
| commit | e5b62d7424da24799c4d16f0e104fac3008e2b89 (patch) | |
| tree | 7d2d710fa43c39dd35d96cc2db371c548a85518f /spec/unit | |
| parent | 94f0b0996ba628f4916bcf0978b29c584c15818b (diff) | |
| parent | d203853bc8b40732c2ba88a4e5396f00a1e3a4ec (diff) | |
Merge branch '2.7.x' of github.com:puppetlabs/puppet into 2.7.x
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/application/face_base_spec.rb | 8 | ||||
| -rwxr-xr-x | spec/unit/face/plugin_spec.rb | 10 | ||||
| -rwxr-xr-x | spec/unit/face/secret_agent_spec.rb | 3 | ||||
| -rwxr-xr-x | spec/unit/file_serving/fileset_spec.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/network/http/api/v1_spec.rb | 8 |
5 files changed, 33 insertions, 3 deletions
diff --git a/spec/unit/application/face_base_spec.rb b/spec/unit/application/face_base_spec.rb index d8c970157..133e6b2e9 100755 --- a/spec/unit/application/face_base_spec.rb +++ b/spec/unit/application/face_base_spec.rb @@ -319,5 +319,13 @@ EOT expect { app.run }.to exit_with 0 }.to have_printed(/--- 3/) end + + it "should invoke when_rendering hook 's' when asked to render-as 's'" do + app.command_line.stubs(:args).returns %w{with_s_rendering_hook --render-as s} + app.action = app.face.get_action(:with_s_rendering_hook) + expect { + expect { app.run }.to exit_with 0 + }.to have_printed(/you invoked the 's' rendering hook/) + end end end diff --git a/spec/unit/face/plugin_spec.rb b/spec/unit/face/plugin_spec.rb new file mode 100755 index 000000000..383aaa3d3 --- /dev/null +++ b/spec/unit/face/plugin_spec.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env rspec +require 'spec_helper' +require 'puppet/face' + +describe Puppet::Face[:plugin, '0.0.1'] do + [:download].each do |action| + it { should be_action action } + it { should respond_to action } + end +end diff --git a/spec/unit/face/secret_agent_spec.rb b/spec/unit/face/secret_agent_spec.rb index beeb4f57b..a5ec01f27 100755 --- a/spec/unit/face/secret_agent_spec.rb +++ b/spec/unit/face/secret_agent_spec.rb @@ -7,6 +7,7 @@ require 'tempfile' describe Puppet::Face[:secret_agent, '0.0.1'] do describe "#synchronize" do it "should retrieve and apply a catalog and return a report" do + pending "This test doesn't work, but the code actually does - tested by LAK" dirname = Dir.mktmpdir("puppetdir") Puppet[:vardir] = dirname Puppet[:confdir] = dirname @@ -15,7 +16,7 @@ describe Puppet::Face[:secret_agent, '0.0.1'] do @catalog.add_resource(@file) Puppet::Resource::Catalog::Rest.any_instance.stubs(:find).returns(@catalog) - report = subject.synchronize("foo") + report = subject.synchronize report.kind.should == "apply" report.status.should == "changed" diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index a369ad39c..41810650a 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -20,6 +20,13 @@ describe Puppet::FileServing::Fileset, " when initializing" do fileset.path.should == path end + it "should not fail if the path is just the file separator" do + path = File::SEPARATOR + File.stubs(:lstat).with(path).returns stub('stat') + fileset = Puppet::FileServing::Fileset.new(path) + fileset.path.should == path + end + it "should fail if its path does not exist" do File.expects(:lstat).with("/some/file").returns nil proc { Puppet::FileServing::Fileset.new("/some/file") }.should raise_error(ArgumentError) diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index bd95071c1..a952f24e2 100755 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -31,7 +31,7 @@ describe Puppet::Network::HTTP::API::V1 do end it "should use the first field of the URI as the environment" do - @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].should == "env" + @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].to_s.should == "env" end it "should fail if the environment is not alphanumeric" do @@ -39,7 +39,11 @@ describe Puppet::Network::HTTP::API::V1 do end it "should use the environment from the URI even if one is specified in the parameters" do - @tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"})[3][:environment].should == "env" + @tester.uri2indirection("GET", "/env/foo/bar", {:environment => "otherenv"})[3][:environment].to_s.should == "env" + end + + it "should return the environment as a Puppet::Node::Environment" do + @tester.uri2indirection("GET", "/env/foo/bar", {})[3][:environment].should be_a Puppet::Node::Environment end it "should use the second field of the URI as the indirection name" do |
