summaryrefslogtreecommitdiffstats
path: root/spec/unit/application
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/application
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/application')
-rwxr-xr-xspec/unit/application/apply_spec.rb11
-rw-r--r--spec/unit/application/master_spec.rb9
2 files changed, 9 insertions, 11 deletions
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index 0b00d1a2e..a79ddbad3 100755
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -142,17 +142,16 @@ describe Puppet::Application::Apply do
describe "the parseonly command" do
before :each do
- Puppet.stubs(:[]).with(:environment)
+ @environment = Puppet::Node::Environment.new("env")
+ Puppet.stubs(:[]).with(:environment).returns(@environment)
Puppet.stubs(:[]).with(:manifest).returns("site.pp")
Puppet.stubs(:err)
@apply.stubs(:exit)
@apply.options.stubs(:[]).with(:code).returns "some code"
- @collection = stub_everything
- Puppet::Resource::TypeCollection.stubs(:new).returns(@collection)
end
- it "should use a Puppet Resource Type Collection to parse the file" do
- @collection.expects(:perform_initial_import)
+ it "should use the environment to parse the file" do
+ @environment.stubs(:perform_initial_import)
@apply.parseonly
end
@@ -162,7 +161,7 @@ describe Puppet::Application::Apply do
end
it "should exit with exit code 1 if error" do
- @collection.stubs(:perform_initial_import).raises(Puppet::ParseError)
+ @environment.stubs(:perform_initial_import).raises(Puppet::ParseError)
@apply.expects(:exit).with(1)
@apply.parseonly
end
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb
index 0baa8229b..d23021317 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -257,16 +257,15 @@ describe Puppet::Application::Master do
describe "the parseonly command" do
before :each do
- Puppet.stubs(:[]).with(:environment)
+ @environment = Puppet::Node::Environment.new("env")
+ Puppet.stubs(:[]).with(:environment).returns(@environment)
Puppet.stubs(:[]).with(:manifest).returns("site.pp")
Puppet.stubs(:err)
@master.stubs(:exit)
- @collection = stub_everything
- Puppet::Resource::TypeCollection.stubs(:new).returns(@collection)
end
it "should use a Puppet Resource Type Collection to parse the file" do
- @collection.expects(:perform_initial_import)
+ @environment.expects(:perform_initial_import)
@master.parseonly
end
@@ -276,7 +275,7 @@ describe Puppet::Application::Master do
end
it "should exit with exit code 1 if error" do
- @collection.stubs(:perform_initial_import).raises(Puppet::ParseError)
+ @environment.stubs(:perform_initial_import).raises(Puppet::ParseError)
@master.expects(:exit).with(1)
@master.parseonly
end