summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/parser/resource/reference.rb7
-rwxr-xr-xspec/unit/property.rb6
-rw-r--r--spec/unit/type/resources.rb2
3 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/parser/resource/reference.rb b/spec/unit/parser/resource/reference.rb
index 6284e67cc..a703f9284 100755
--- a/spec/unit/parser/resource/reference.rb
+++ b/spec/unit/parser/resource/reference.rb
@@ -40,10 +40,15 @@ describe Puppet::Parser::Resource::Reference do
ref.to_s.should == "File[/tmp/yay]"
end
- it "should canonize resource references" do
+ it "should canonize resource reference types" do
ref = @type.new(:type => "foo::bar", :title => "/tmp/yay")
ref.to_s.should == "Foo::Bar[/tmp/yay]"
end
+
+ it "should canonize resource reference values" do
+ ref = @type.new(:type => "file", :title => "/tmp/yay/")
+ ref.to_s.should == "File[/tmp/yay]"
+ end
end
describe Puppet::Parser::Resource::Reference, " when modeling defined types" do
diff --git a/spec/unit/property.rb b/spec/unit/property.rb
index 26a5765a2..03b848b15 100755
--- a/spec/unit/property.rb
+++ b/spec/unit/property.rb
@@ -101,6 +101,12 @@ describe Puppet::Property do
@property.should.must == [:one, :two]
end
+ it "should munge the canonicalization of the value" do
+ @property.class.to_canonicalize { |x| x.reverse }
+ @property.value = 'data'
+ @property.should.must == 'atad'
+ end
+
it "should return any set value" do
(@property.value = :one).should == :one
end
diff --git a/spec/unit/type/resources.rb b/spec/unit/type/resources.rb
index a3faededa..480b6c00d 100644
--- a/spec/unit/type/resources.rb
+++ b/spec/unit/type/resources.rb
@@ -8,7 +8,7 @@ resources = Puppet::Type.type(:resources)
describe resources do
describe "when initializing" do
it "should fail if the specified resource type does not exist" do
- Puppet::Type.stubs(:type).with("Resources").returns resources
+ Puppet::Type.stubs(:type).with { |x| x.to_s.downcase == "resources"}.returns resources
Puppet::Type.expects(:type).with("nosuchtype").returns nil
lambda { resources.new :name => "nosuchtype" }.should raise_error(Puppet::Error)
end