Signed-off-by: Luke Kanies <[email protected]>
---
spec/integration/application/puppet.rb | 27 +++++++++++++++------------
spec/integration/defaults.rb | 2 ++
spec/integration/network/formats.rb | 6 +++++-
spec/integration/resource/catalog.rb | 7 +++++--
spec/unit/application/puppet.rb | 2 ++
spec/unit/indirector/queue.rb | 2 ++
6 files changed, 31 insertions(+), 15 deletions(-)
mode change 100644 => 100755 spec/unit/application/puppet.rb
diff --git a/spec/integration/application/puppet.rb
b/spec/integration/application/puppet.rb
index 0047dd5..e3f8fb9 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 38a4e16..1a73521 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 3ea26f5..7d0d47e 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 11bdb56..9c7c37d 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
old mode 100644
new mode 100755
index ca12034..00fe1dd
--- 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 3bc0668..c81cefe 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
--
1.6.1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---