summaryrefslogtreecommitdiffstats
path: root/spec/unit/resource
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-08-13 15:25:17 -0700
committerPaul Berry <paul@puppetlabs.com>2010-08-13 15:53:29 -0700
commitcaca187dffbd6e628d7eda599c7f2939dd05fafc (patch)
tree3bda82a89dd30d9612a229ac3b38588df146b50a /spec/unit/resource
parent6b1dd81799a44288287d9ab0cdf46afa3aaf090a (diff)
Moved perform_initial_import from Puppet::Resource::TypeCollection to Puppet::Node::Environment.
This change is part of an ongoing effort to remove functionality from TypeCollection that is not related to keeping track of a collection of types. This reduces TypeCollection's linkage to the environment, which is a step toward decoupling it from the type loading mechanism. Also, added a spec test to verify that TypeCollection.version is correctly recomputed when types are re-imported.
Diffstat (limited to 'spec/unit/resource')
-rw-r--r--spec/unit/resource/type_collection_spec.rb52
1 files changed, 0 insertions, 52 deletions
diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb
index 4bad29116..fc53e35b1 100644
--- a/spec/unit/resource/type_collection_spec.rb
+++ b/spec/unit/resource/type_collection_spec.rb
@@ -416,58 +416,6 @@ describe Puppet::Resource::TypeCollection do
end
end
- describe "when performing initial import" do
- before do
- @parser = stub 'parser', :file= => nil, :string => nil, :parse => nil
- Puppet::Parser::Parser.stubs(:new).returns @parser
- @code = Puppet::Resource::TypeCollection.new("env")
- end
-
- it "should create a new parser instance" do
- Puppet::Parser::Parser.expects(:new).returns @parser
- @code.perform_initial_import
- end
-
- it "should set the parser's string to the 'code' setting and parse if code is available" do
- Puppet.settings[:code] = "my code"
- @parser.expects(:string=).with "my code"
- @parser.expects(:parse)
- @code.perform_initial_import
- end
-
- it "should set the parser's file to the 'manifest' setting and parse if no code is available and the manifest is available" do
- File.stubs(:expand_path).with("/my/file").returns "/my/file"
- File.expects(:exist?).with("/my/file").returns true
- Puppet.settings[:manifest] = "/my/file"
- @parser.expects(:file=).with "/my/file"
- @parser.expects(:parse)
- @code.perform_initial_import
- end
-
- it "should not attempt to load a manifest if none is present" do
- File.stubs(:expand_path).with("/my/file").returns "/my/file"
- File.expects(:exist?).with("/my/file").returns false
- Puppet.settings[:manifest] = "/my/file"
- @parser.expects(:file=).never
- @parser.expects(:parse).never
- @code.perform_initial_import
- end
-
- it "should fail helpfully if there is an error importing" do
- File.stubs(:exist?).returns true
- @parser.expects(:parse).raises ArgumentError
- lambda { @code.perform_initial_import }.should raise_error(Puppet::Error)
- end
-
- it "should not do anything if the ignore_import settings is set" do
- Puppet.settings[:ignoreimport] = true
- @parser.expects(:string=).never
- @parser.expects(:file=).never
- @parser.expects(:parse).never
- @code.perform_initial_import
- end
- end
-
describe "when determining the configuration version" do
before do
@code = Puppet::Resource::TypeCollection.new("env")