diff options
author | Luke Kanies <luke@madstop.com> | 2009-08-10 04:31:26 +0000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-08-10 17:39:40 +1000 |
commit | a88fc4d24c50d91aa764fa8f52797e86bb6d8965 (patch) | |
tree | e4d77ea5dcdd29cf039788d5e37ac41e183bc644 /spec | |
parent | 9a356ab289a64245cf59cd763dc953a93d71682b (diff) | |
download | puppet-a88fc4d24c50d91aa764fa8f52797e86bb6d8965.tar.gz puppet-a88fc4d24c50d91aa764fa8f52797e86bb6d8965.tar.xz puppet-a88fc4d24c50d91aa764fa8f52797e86bb6d8965.zip |
Fixing more tests broken from missing libraries
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/integration/application/puppet.rb | 27 | ||||
-rwxr-xr-x | spec/integration/defaults.rb | 2 | ||||
-rwxr-xr-x | spec/integration/network/formats.rb | 6 | ||||
-rwxr-xr-x | spec/integration/resource/catalog.rb | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | spec/unit/application/puppet.rb | 2 | ||||
-rwxr-xr-x | spec/unit/indirector/queue.rb | 2 |
6 files changed, 31 insertions, 15 deletions
diff --git a/spec/integration/application/puppet.rb b/spec/integration/application/puppet.rb index 0047dd5a3..e3f8fb9fc 100755 --- a/spec/integration/application/puppet.rb +++ b/spec/integration/application/puppet.rb @@ -9,22 +9,25 @@ require 'puppet/application/puppet' describe "Puppet" do include PuppetSpec::Files - it "should be able to apply catalogs provided in a file in json" do - file_to_create = tmpfile("json_catalog") - catalog = Puppet::Resource::Catalog.new - resource = Puppet::Resource.new(:file, file_to_create, :content => "my stuff") - catalog.add_resource resource + describe "when applying provided catalogs" do + confine "JSON library is missing; cannot test applying catalogs" => Puppet.features.json? + it "should be able to apply catalogs provided in a file in json" do + file_to_create = tmpfile("json_catalog") + catalog = Puppet::Resource::Catalog.new + resource = Puppet::Resource.new(:file, file_to_create, :content => "my stuff") + catalog.add_resource resource - manifest = tmpfile("manifest") + manifest = tmpfile("manifest") - File.open(manifest, "w") { |f| f.print catalog.to_json } + File.open(manifest, "w") { |f| f.print catalog.to_json } - puppet = Puppet::Application[:puppet] - puppet.options[:catalog] = manifest + puppet = Puppet::Application[:puppet] + puppet.options[:catalog] = manifest - puppet.apply + puppet.apply - File.should be_exist(file_to_create) - File.read(file_to_create).should == "my stuff" + File.should be_exist(file_to_create) + File.read(file_to_create).should == "my stuff" + end end end diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb index 38a4e16b1..1a73521bd 100755 --- a/spec/integration/defaults.rb +++ b/spec/integration/defaults.rb @@ -118,6 +118,7 @@ describe "Puppet defaults" do Puppet::Resource::Catalog.stubs(:cache_class=) Puppet::Node::Facts.stubs(:cache_class=) Puppet::Node.stubs(:cache_class=) + Puppet.features.stubs(:rails?).returns true end it "should set storeconfigs to true" do @@ -146,6 +147,7 @@ describe "Puppet defaults" do Puppet::Resource::Catalog.stubs(:cache_class=) Puppet::Node::Facts.stubs(:cache_class=) Puppet::Node.stubs(:cache_class=) + Puppet.features.stubs(:rails?).returns true end it "should set storeconfigs to true" do diff --git a/spec/integration/network/formats.rb b/spec/integration/network/formats.rb index 3ea26f534..7d0d47ee7 100755 --- a/spec/integration/network/formats.rb +++ b/spec/integration/network/formats.rb @@ -47,7 +47,11 @@ end describe Puppet::Network::FormatHandler.format(:json) do describe "when json is absent" do - confine "'json' library is prsent" => (! Puppet.features.json?) + confine "'json' library is present" => (! Puppet.features.json?) + + before do + @json = Puppet::Network::FormatHandler.format(:json) + end it "should not be suitable" do @json.should_not be_suitable diff --git a/spec/integration/resource/catalog.rb b/spec/integration/resource/catalog.rb index 11bdb56f6..9c7c37d8e 100755 --- a/spec/integration/resource/catalog.rb +++ b/spec/integration/resource/catalog.rb @@ -6,8 +6,11 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Resource::Catalog do - it "should support json" do - Puppet::Resource::Catalog.supported_formats.should be_include(:json) + describe "when json is available" do + confine "JSON library is missing" => Puppet.features.json? + it "should support json" do + Puppet::Resource::Catalog.supported_formats.should be_include(:json) + end end describe "when using the indirector" do diff --git a/spec/unit/application/puppet.rb b/spec/unit/application/puppet.rb index ca1203405..00fe1ddea 100644..100755 --- a/spec/unit/application/puppet.rb +++ b/spec/unit/application/puppet.rb @@ -331,6 +331,8 @@ describe "Puppet" do end describe "the 'apply' command" do + confine "JSON library is missing; cannot test applying catalogs" => Puppet.features.json? + before do #Puppet::Resource::Catalog.stubs(:json_create).returns Puppet::Resource::Catalog.new JSON.stubs(:parse).returns Puppet::Resource::Catalog.new diff --git a/spec/unit/indirector/queue.rb b/spec/unit/indirector/queue.rb index 3bc066873..c81cefec9 100755 --- a/spec/unit/indirector/queue.rb +++ b/spec/unit/indirector/queue.rb @@ -27,6 +27,8 @@ class FooExampleData end describe Puppet::Indirector::Queue do + confine "JSON library is missing; cannot test queueing" => Puppet.features.json? + before :each do @model = mock 'model' @indirection = stub 'indirection', :name => :my_queue, :register_terminus_type => nil, :model => @model |