summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-25 13:21:32 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-11-26 12:56:12 +1100
commit5bd27c8b81c3250dd04307460868ff113b64190c (patch)
treef351f63bbfcaafae9b93f364483402817ed7cdad /spec/unit
parenta3140b2285d3cb3ccc44efa2110da58771834cde (diff)
downloadpuppet-5bd27c8b81c3250dd04307460868ff113b64190c.tar.gz
puppet-5bd27c8b81c3250dd04307460868ff113b64190c.tar.xz
puppet-5bd27c8b81c3250dd04307460868ff113b64190c.zip
Partially fixing #1772 - broken 'resources' tests.
The main problem was that the directory_services user provider was returning a string for its uid instead of an integer. I also began a 'resources' spec file. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/type/resources.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/type/resources.rb b/spec/unit/type/resources.rb
new file mode 100644
index 000000000..2c323ba24
--- /dev/null
+++ b/spec/unit/type/resources.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+resources = Puppet::Type.type(:resources)
+
+# There are still plenty of tests to port over from test/.
+describe resources do
+ describe "when initializing" do
+ before do
+ resources.clear
+ end
+
+ it "should fail if the specified resource type does not exist" do
+ Puppet::Type.expects(:type).with("nosuchtype").returns nil
+ lambda { resources.create :name => "nosuchtype" }.should raise_error(Puppet::Error)
+ end
+
+ it "should not fail when the specified resource type exists" do
+ lambda { resources.create :name => "file" }.should_not raise_error
+ end
+
+ it "should set its :resource_type attribute" do
+ resources.create(:name => "file").resource_type.should == Puppet::Type.type(:file)
+ end
+ end
+end