diff options
author | James Turnbull <james@lovedthanlost.net> | 2008-06-18 08:14:29 +1000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-06-18 08:14:29 +1000 |
commit | 117869fa1614cd3b4ff4e5e0df5ece699eb1fe56 (patch) | |
tree | 069be37b6e281c377055b1af7b68decf0b5ec1a3 | |
parent | 17afb8afa0f1c3c58f2947f62938d262ae91b3c1 (diff) | |
parent | 5a283d644b68bd89dc3c016ffd062b3ba792c617 (diff) | |
download | puppet-117869fa1614cd3b4ff4e5e0df5ece699eb1fe56.tar.gz puppet-117869fa1614cd3b4ff4e5e0df5ece699eb1fe56.tar.xz puppet-117869fa1614cd3b4ff4e5e0df5ece699eb1fe56.zip |
Merge branch 'tickets/0.24.x/1374' of git://github.com/lak/puppet into 0.24.x
-rwxr-xr-x | spec/unit/type/exec.rb | 6 | ||||
-rwxr-xr-x | spec/unit/type/package.rb | 72 | ||||
-rwxr-xr-x | spec/unit/type/schedule.rb | 40 | ||||
-rwxr-xr-x | spec/unit/type/service.rb | 100 |
4 files changed, 105 insertions, 113 deletions
diff --git a/spec/unit/type/exec.rb b/spec/unit/type/exec.rb index cf0e02929..c6c082dd5 100755 --- a/spec/unit/type/exec.rb +++ b/spec/unit/type/exec.rb @@ -2,8 +2,6 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/type/exec' - module ExecModuleTesting def create_resource(command, output, exitstatus) @user_name = 'some_user_name' @@ -30,7 +28,7 @@ module ExecModuleTesting end end -describe Puppet::Type::Exec, " when execing" do +describe Puppet::Type.type(:exec), " when execing" do include ExecModuleTesting it "should use the 'run_and_capture' method to exec" do @@ -69,7 +67,7 @@ describe Puppet::Type::Exec, " when execing" do end -describe Puppet::Type::Exec, " when logoutput=>on_failure is set," do +describe Puppet::Type.type(:exec), " when logoutput=>on_failure is set," do include ExecModuleTesting it "should log the output on failure" do diff --git a/spec/unit/type/package.rb b/spec/unit/type/package.rb index 335910c63..3ceb8e32b 100755 --- a/spec/unit/type/package.rb +++ b/spec/unit/type/package.rb @@ -2,103 +2,101 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/type/package' - -describe Puppet::Type::Package do +describe Puppet::Type.type(:package) do it "should have an :installable feature that requires the :install method" do - Puppet::Type::Package.provider_feature(:installable).methods.should == [:install] + Puppet::Type.type(:package).provider_feature(:installable).methods.should == [:install] end it "should have an :uninstallable feature that requires the :uninstall method" do - Puppet::Type::Package.provider_feature(:uninstallable).methods.should == [:uninstall] + Puppet::Type.type(:package).provider_feature(:uninstallable).methods.should == [:uninstall] end it "should have an :upgradeable feature that requires :update and :latest methods" do - Puppet::Type::Package.provider_feature(:upgradeable).methods.should == [:update, :latest] + Puppet::Type.type(:package).provider_feature(:upgradeable).methods.should == [:update, :latest] end it "should have a :purgeable feature that requires the :purge latest method" do - Puppet::Type::Package.provider_feature(:purgeable).methods.should == [:purge] + Puppet::Type.type(:package).provider_feature(:purgeable).methods.should == [:purge] end it "should have a :versionable feature" do - Puppet::Type::Package.provider_feature(:versionable).should_not be_nil + Puppet::Type.type(:package).provider_feature(:versionable).should_not be_nil end it "should default to being installed" do - pkg = Puppet::Type::Package.create(:name => "yay") + pkg = Puppet::Type.type(:package).create(:name => "yay") pkg.should(:ensure).should == :present end - after { Puppet::Type::Package.clear } + after { Puppet::Type.type(:package).clear } end -describe Puppet::Type::Package, "when validating attributes" do +describe Puppet::Type.type(:package), "when validating attributes" do [:name, :source, :instance, :status, :adminfile, :responsefile, :configfiles, :category, :platform, :root, :vendor, :description, :allowcdrom].each do |param| it "should have a #{param} parameter" do - Puppet::Type::Package.attrtype(param).should == :param + Puppet::Type.type(:package).attrtype(param).should == :param end end it "should have an ensure property" do - Puppet::Type::Package.attrtype(:ensure).should == :property + Puppet::Type.type(:package).attrtype(:ensure).should == :property end end -describe Puppet::Type::Package, "when validating attribute values" do +describe Puppet::Type.type(:package), "when validating attribute values" do before do - @provider = stub 'provider', :class => Puppet::Type::Package.defaultprovider, :clear => nil - Puppet::Type::Package.defaultprovider.expects(:new).returns(@provider) + @provider = stub 'provider', :class => Puppet::Type.type(:package).defaultprovider, :clear => nil + Puppet::Type.type(:package).defaultprovider.expects(:new).returns(@provider) end it "should support :present as a value to :ensure" do - Puppet::Type::Package.create(:name => "yay", :ensure => :present) + Puppet::Type.type(:package).create(:name => "yay", :ensure => :present) end it "should alias :installed to :present as a value to :ensure" do - pkg = Puppet::Type::Package.create(:name => "yay", :ensure => :installed) + pkg = Puppet::Type.type(:package).create(:name => "yay", :ensure => :installed) pkg.should(:ensure).should == :present end it "should support :absent as a value to :ensure" do - Puppet::Type::Package.create(:name => "yay", :ensure => :absent) + Puppet::Type.type(:package).create(:name => "yay", :ensure => :absent) end it "should support :purged as a value to :ensure if the provider has the :purgeable feature" do @provider.expects(:satisfies?).with(:purgeable).returns(true) - Puppet::Type::Package.create(:name => "yay", :ensure => :purged) + Puppet::Type.type(:package).create(:name => "yay", :ensure => :purged) end it "should not support :purged as a value to :ensure if the provider does not have the :purgeable feature" do @provider.expects(:satisfies?).with(:purgeable).returns(false) - proc { Puppet::Type::Package.create(:name => "yay", :ensure => :purged) }.should raise_error(Puppet::Error) + proc { Puppet::Type.type(:package).create(:name => "yay", :ensure => :purged) }.should raise_error(Puppet::Error) end it "should support :latest as a value to :ensure if the provider has the :upgradeable feature" do @provider.expects(:satisfies?).with(:upgradeable).returns(true) - Puppet::Type::Package.create(:name => "yay", :ensure => :latest) + Puppet::Type.type(:package).create(:name => "yay", :ensure => :latest) end it "should not support :latest as a value to :ensure if the provider does not have the :upgradeable feature" do @provider.expects(:satisfies?).with(:upgradeable).returns(false) - proc { Puppet::Type::Package.create(:name => "yay", :ensure => :latest) }.should raise_error(Puppet::Error) + proc { Puppet::Type.type(:package).create(:name => "yay", :ensure => :latest) }.should raise_error(Puppet::Error) end it "should support version numbers as a value to :ensure if the provider has the :versionable feature" do @provider.expects(:satisfies?).with(:versionable).returns(true) - Puppet::Type::Package.create(:name => "yay", :ensure => "1.0") + Puppet::Type.type(:package).create(:name => "yay", :ensure => "1.0") end it "should not support version numbers as a value to :ensure if the provider does not have the :versionable feature" do @provider.expects(:satisfies?).with(:versionable).returns(false) - proc { Puppet::Type::Package.create(:name => "yay", :ensure => "1.0") }.should raise_error(Puppet::Error) + proc { Puppet::Type.type(:package).create(:name => "yay", :ensure => "1.0") }.should raise_error(Puppet::Error) end it "should accept any string as an argument to :source" do - proc { Puppet::Type::Package.create(:name => "yay", :source => "stuff") }.should_not raise_error(Puppet::Error) + proc { Puppet::Type.type(:package).create(:name => "yay", :source => "stuff") }.should_not raise_error(Puppet::Error) end - after { Puppet::Type::Package.clear } + after { Puppet::Type.type(:package).clear } end module PackageEvaluationTesting @@ -107,11 +105,11 @@ module PackageEvaluationTesting end end -describe Puppet::Type::Package do +describe Puppet::Type.type(:package) do before :each do - @provider = stub 'provider', :class => Puppet::Type::Package.defaultprovider, :clear => nil, :satisfies? => true, :name => :mock - Puppet::Type::Package.defaultprovider.stubs(:new).returns(@provider) - @package = Puppet::Type::Package.create(:name => "yay") + @provider = stub 'provider', :class => Puppet::Type.type(:package).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock + Puppet::Type.type(:package).defaultprovider.stubs(:new).returns(@provider) + @package = Puppet::Type.type(:package).create(:name => "yay") @catalog = Puppet::Node::Catalog.new @catalog.add_resource(@package) @@ -119,11 +117,11 @@ describe Puppet::Type::Package do after :each do @catalog.clear(true) - Puppet::Type::Package.clear + Puppet::Type.type(:package).clear end - describe Puppet::Type::Package, "when it should be purged" do + describe Puppet::Type.type(:package), "when it should be purged" do include PackageEvaluationTesting before { @package[:ensure] = :purged } @@ -142,7 +140,7 @@ describe Puppet::Type::Package do end end - describe Puppet::Type::Package, "when it should be absent" do + describe Puppet::Type.type(:package), "when it should be absent" do include PackageEvaluationTesting before { @package[:ensure] = :absent } @@ -163,7 +161,7 @@ describe Puppet::Type::Package do end end - describe Puppet::Type::Package, "when it should be present" do + describe Puppet::Type.type(:package), "when it should be present" do include PackageEvaluationTesting before { @package[:ensure] = :present } @@ -184,7 +182,7 @@ describe Puppet::Type::Package do end end - describe Puppet::Type::Package, "when it should be latest" do + describe Puppet::Type.type(:package), "when it should be latest" do include PackageEvaluationTesting before { @package[:ensure] = :latest } @@ -219,7 +217,7 @@ describe Puppet::Type::Package do end end - describe Puppet::Type::Package, "when it should be a specific version" do + describe Puppet::Type.type(:package), "when it should be a specific version" do include PackageEvaluationTesting before { @package[:ensure] = "1.0" } diff --git a/spec/unit/type/schedule.rb b/spec/unit/type/schedule.rb index da38f68a9..d5d4c6039 100755 --- a/spec/unit/type/schedule.rb +++ b/spec/unit/type/schedule.rb @@ -2,8 +2,6 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/type/schedule' - module ScheduleTesting def format(time) @@ -41,20 +39,20 @@ module ScheduleTesting end -describe Puppet::Type::Schedule do +describe Puppet::Type.type(:schedule) do before :each do Puppet.settings.stubs(:value).with(:ignoreschedules).returns(false) - @schedule = Puppet::Type::Schedule.create(:name => "testing") + @schedule = Puppet::Type.type(:schedule).create(:name => "testing") end after :each do - Puppet::Type::Schedule.clear + Puppet::Type.type(:schedule).clear end - describe Puppet::Type::Schedule do + describe Puppet::Type.type(:schedule) do include ScheduleTesting it "should default to :distance for period-matching" do @@ -71,26 +69,26 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when producing default schedules" do + describe Puppet::Type.type(:schedule), "when producing default schedules" do include ScheduleTesting %w{hourly daily weekly monthly never}.each do |period| period = period.to_sym it "should produce a #{period} schedule with the period set appropriately" do - schedules = Puppet::Type::Schedule.mkdefaultschedules - schedules.find { |s| s[:name] == period.to_s and s[:period] == period }.should be_instance_of(Puppet::Type::Schedule) + schedules = Puppet::Type.type(:schedule).mkdefaultschedules + schedules.find { |s| s[:name] == period.to_s and s[:period] == period }.should be_instance_of(Puppet::Type.type(:schedule)) end end it "should produce a schedule named puppet with a period of hourly and a repeat of 2" do - schedules = Puppet::Type::Schedule.mkdefaultschedules + schedules = Puppet::Type.type(:schedule).mkdefaultschedules schedules.find { |s| s[:name] == "puppet" and s[:period] == :hourly and s[:repeat] == 2 - }.should be_instance_of(Puppet::Type::Schedule) + }.should be_instance_of(Puppet::Type.type(:schedule)) end end - describe Puppet::Type::Schedule, "when matching ranges" do + describe Puppet::Type.type(:schedule), "when matching ranges" do include ScheduleTesting it "should match when the start time is before the current time and the end time is after the current time" do @@ -109,7 +107,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching hourly by distance" do + describe Puppet::Type.type(:schedule), "when matching hourly by distance" do include ScheduleTesting before do @@ -130,7 +128,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching daily by distance" do + describe Puppet::Type.type(:schedule), "when matching daily by distance" do include ScheduleTesting before do @@ -151,7 +149,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching weekly by distance" do + describe Puppet::Type.type(:schedule), "when matching weekly by distance" do include ScheduleTesting before do @@ -172,7 +170,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching monthly by distance" do + describe Puppet::Type.type(:schedule), "when matching monthly by distance" do include ScheduleTesting before do @@ -193,7 +191,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching hourly by number" do + describe Puppet::Type.type(:schedule), "when matching hourly by number" do include ScheduleTesting before do @@ -226,7 +224,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching daily by number" do + describe Puppet::Type.type(:schedule), "when matching daily by number" do include ScheduleTesting before do @@ -261,7 +259,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching weekly by number" do + describe Puppet::Type.type(:schedule), "when matching weekly by number" do include ScheduleTesting before do @@ -288,7 +286,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching monthly by number" do + describe Puppet::Type.type(:schedule), "when matching monthly by number" do include ScheduleTesting before do @@ -315,7 +313,7 @@ describe Puppet::Type::Schedule do end end - describe Puppet::Type::Schedule, "when matching with a repeat greater than one" do + describe Puppet::Type.type(:schedule), "when matching with a repeat greater than one" do include ScheduleTesting before do diff --git a/spec/unit/type/service.rb b/spec/unit/type/service.rb index e8358cb22..12dda3edb 100755 --- a/spec/unit/type/service.rb +++ b/spec/unit/type/service.rb @@ -2,159 +2,157 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/type/service' - -describe Puppet::Type::Service do +describe Puppet::Type.type(:service) do it "should have an :enableable feature that requires the :enable, :disable, and :enabled? methods" do - Puppet::Type::Service.provider_feature(:enableable).methods.should == [:disable, :enable, :enabled?] + Puppet::Type.type(:service).provider_feature(:enableable).methods.should == [:disable, :enable, :enabled?] end it "should have a :refreshable feature that requires the :restart method" do - Puppet::Type::Service.provider_feature(:refreshable).methods.should == [:restart] + Puppet::Type.type(:service).provider_feature(:refreshable).methods.should == [:restart] end end -describe Puppet::Type::Service, "when validating attributes" do +describe Puppet::Type.type(:service), "when validating attributes" do [:name, :binary, :hasstatus, :path, :pattern, :start, :restart, :stop, :status, :hasrestart, :control].each do |param| it "should have a #{param} parameter" do - Puppet::Type::Service.attrtype(param).should == :param + Puppet::Type.type(:service).attrtype(param).should == :param end end [:ensure, :enable].each do |param| it "should have an #{param} property" do - Puppet::Type::Service.attrtype(param).should == :property + Puppet::Type.type(:service).attrtype(param).should == :property end end end -describe Puppet::Type::Service, "when validating attribute values" do +describe Puppet::Type.type(:service), "when validating attribute values" do before do - @provider = stub 'provider', :class => Puppet::Type::Service.defaultprovider, :clear => nil, :controllable? => false - Puppet::Type::Service.defaultprovider.stubs(:new).returns(@provider) + @provider = stub 'provider', :class => Puppet::Type.type(:service).defaultprovider, :clear => nil, :controllable? => false + Puppet::Type.type(:service).defaultprovider.stubs(:new).returns(@provider) end it "should support :running as a value to :ensure" do - Puppet::Type::Service.create(:name => "yay", :ensure => :running) + Puppet::Type.type(:service).create(:name => "yay", :ensure => :running) end it "should support :stopped as a value to :ensure" do - Puppet::Type::Service.create(:name => "yay", :ensure => :stopped) + Puppet::Type.type(:service).create(:name => "yay", :ensure => :stopped) end it "should alias the value :true to :running in :ensure" do - svc = Puppet::Type::Service.create(:name => "yay", :ensure => true) + svc = Puppet::Type.type(:service).create(:name => "yay", :ensure => true) svc.should(:ensure).should == :running end it "should alias the value :false to :stopped in :ensure" do - svc = Puppet::Type::Service.create(:name => "yay", :ensure => false) + svc = Puppet::Type.type(:service).create(:name => "yay", :ensure => false) svc.should(:ensure).should == :stopped end it "should support :true as a value to :enable" do - Puppet::Type::Service.create(:name => "yay", :enable => :true) + Puppet::Type.type(:service).create(:name => "yay", :enable => :true) end it "should support :false as a value to :enable" do - Puppet::Type::Service.create(:name => "yay", :enable => :false) + Puppet::Type.type(:service).create(:name => "yay", :enable => :false) end it "should support :true as a value to :hasstatus" do - Puppet::Type::Service.create(:name => "yay", :hasstatus => :true) + Puppet::Type.type(:service).create(:name => "yay", :hasstatus => :true) end it "should support :false as a value to :hasstatus" do - Puppet::Type::Service.create(:name => "yay", :hasstatus => :false) + Puppet::Type.type(:service).create(:name => "yay", :hasstatus => :false) end it "should support :true as a value to :hasrestart" do - Puppet::Type::Service.create(:name => "yay", :hasrestart => :true) + Puppet::Type.type(:service).create(:name => "yay", :hasrestart => :true) end it "should support :false as a value to :hasrestart" do - Puppet::Type::Service.create(:name => "yay", :hasrestart => :false) + Puppet::Type.type(:service).create(:name => "yay", :hasrestart => :false) end it "should allow setting the :enable parameter if the provider has the :enableable feature" do - Puppet::Type::Service.defaultprovider.stubs(:supports_parameter?).returns(true) - Puppet::Type::Service.defaultprovider.expects(:supports_parameter?).with(Puppet::Type::Service.attrclass(:enable)).returns(true) - svc = Puppet::Type::Service.create(:name => "yay", :enable => true) + Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true) + Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(true) + svc = Puppet::Type.type(:service).create(:name => "yay", :enable => true) svc.should(:enable).should == :true end it "should not allow setting the :enable parameter if the provider is missing the :enableable feature" do - Puppet::Type::Service.defaultprovider.stubs(:supports_parameter?).returns(true) - Puppet::Type::Service.defaultprovider.expects(:supports_parameter?).with(Puppet::Type::Service.attrclass(:enable)).returns(false) - svc = Puppet::Type::Service.create(:name => "yay", :enable => true) + Puppet::Type.type(:service).defaultprovider.stubs(:supports_parameter?).returns(true) + Puppet::Type.type(:service).defaultprovider.expects(:supports_parameter?).with(Puppet::Type.type(:service).attrclass(:enable)).returns(false) + svc = Puppet::Type.type(:service).create(:name => "yay", :enable => true) svc.should(:enable).should be_nil end it "should discard paths that do not exist" do FileTest.stubs(:exist?).returns(false) FileTest.stubs(:directory?).returns(false) - svc = Puppet::Type::Service.create(:name => "yay", :path => "/one/two") + svc = Puppet::Type.type(:service).create(:name => "yay", :path => "/one/two") svc[:path].should be_empty end it "should discard paths that are not directories" do FileTest.stubs(:exist?).returns(true) FileTest.stubs(:directory?).returns(false) - svc = Puppet::Type::Service.create(:name => "yay", :path => "/one/two") + svc = Puppet::Type.type(:service).create(:name => "yay", :path => "/one/two") svc[:path].should be_empty end it "should split paths on ':'" do FileTest.stubs(:exist?).returns(true) FileTest.stubs(:directory?).returns(true) - svc = Puppet::Type::Service.create(:name => "yay", :path => "/one/two:/three/four") + svc = Puppet::Type.type(:service).create(:name => "yay", :path => "/one/two:/three/four") svc[:path].should == %w{/one/two /three/four} end it "should accept arrays of paths joined by ':'" do FileTest.stubs(:exist?).returns(true) FileTest.stubs(:directory?).returns(true) - svc = Puppet::Type::Service.create(:name => "yay", :path => ["/one:/two", "/three:/four"]) + svc = Puppet::Type.type(:service).create(:name => "yay", :path => ["/one:/two", "/three:/four"]) svc[:path].should == %w{/one /two /three /four} end - after { Puppet::Type::Service.clear } + after { Puppet::Type.type(:service).clear } end -describe Puppet::Type::Service, "when setting default attribute values" do +describe Puppet::Type.type(:service), "when setting default attribute values" do it "should default to the provider's default path if one is available" do FileTest.stubs(:directory?).returns(true) FileTest.stubs(:exist?).returns(true) - Puppet::Type::Service.defaultprovider.stubs(:respond_to?).returns(true) - Puppet::Type::Service.defaultprovider.stubs(:defpath).returns("testing") - svc = Puppet::Type::Service.create(:name => "other") + Puppet::Type.type(:service).defaultprovider.stubs(:respond_to?).returns(true) + Puppet::Type.type(:service).defaultprovider.stubs(:defpath).returns("testing") + svc = Puppet::Type.type(:service).create(:name => "other") svc[:path].should == ["testing"] end it "should default 'pattern' to the binary if one is provided" do - svc = Puppet::Type::Service.create(:name => "other", :binary => "/some/binary") + svc = Puppet::Type.type(:service).create(:name => "other", :binary => "/some/binary") svc[:pattern].should == "/some/binary" end it "should default 'pattern' to the name if no pattern is provided" do - svc = Puppet::Type::Service.create(:name => "other") + svc = Puppet::Type.type(:service).create(:name => "other") svc[:pattern].should == "other" end it "should default 'control' to the upcased service name with periods replaced by underscores if the provider supports the 'controllable' feature" do - provider = stub 'provider', :controllable? => true, :class => Puppet::Type::Service.defaultprovider, :clear => nil - Puppet::Type::Service.defaultprovider.stubs(:new).returns(provider) - svc = Puppet::Type::Service.create(:name => "nfs.client") + provider = stub 'provider', :controllable? => true, :class => Puppet::Type.type(:service).defaultprovider, :clear => nil + Puppet::Type.type(:service).defaultprovider.stubs(:new).returns(provider) + svc = Puppet::Type.type(:service).create(:name => "nfs.client") svc[:control].should == "NFS_CLIENT_START" end - after { Puppet::Type::Service.clear } + after { Puppet::Type.type(:service).clear } end -describe Puppet::Type::Service, "when retrieving the host's current state" do +describe Puppet::Type.type(:service), "when retrieving the host's current state" do before do - @service = Puppet::Type::Service.create(:name => "yay") + @service = Puppet::Type.type(:service).create(:name => "yay") end it "should use the provider's status to determine whether the service is running" do @@ -170,12 +168,12 @@ describe Puppet::Type::Service, "when retrieving the host's current state" do @service.property(:enable).retrieve.should == :yepper end - after { Puppet::Type::Service.clear } + after { Puppet::Type.type(:service).clear } end -describe Puppet::Type::Service, "when changing the host" do +describe Puppet::Type.type(:service), "when changing the host" do before do - @service = Puppet::Type::Service.create(:name => "yay") + @service = Puppet::Type.type(:service).create(:name => "yay") end it "should start the service if it is supposed to be running" do @@ -218,12 +216,12 @@ describe Puppet::Type::Service, "when changing the host" do @service.property(:ensure).sync end - after { Puppet::Type::Service.clear } + after { Puppet::Type.type(:service).clear } end -describe Puppet::Type::Service, "when refreshing the service" do +describe Puppet::Type.type(:service), "when refreshing the service" do before do - @service = Puppet::Type::Service.create(:name => "yay") + @service = Puppet::Type.type(:service).create(:name => "yay") end it "should restart the service if it is running" do @@ -252,5 +250,5 @@ describe Puppet::Type::Service, "when refreshing the service" do @service.refresh end - after { Puppet::Type::Service.clear } + after { Puppet::Type.type(:service).clear } end |