From 05cd337e2dba037e561d0b9cb4fef78897cf1d85 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Thu, 13 Feb 2014 12:45:55 -0700 Subject: [PATCH] modify redhat_instance provider tests to work with 2.7.x The init service provider in older puppet releases didn't auto-magically exclude service sysv init script names. The redhat_instance service provider isn't intended to be general purposes so testing for the service name blacklisting can be safely removed. --- spec/unit/provider/service/redhat_instance_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/unit/provider/service/redhat_instance_spec.rb b/spec/unit/provider/service/redhat_instance_spec.rb index a03b003..473f03d 100755 --- a/spec/unit/provider/service/redhat_instance_spec.rb +++ b/spec/unit/provider/service/redhat_instance_spec.rb @@ -37,19 +37,20 @@ # test self.instances describe "when getting all service instances" do before :each do - @services = ['one', 'two', 'three', 'four', 'kudzu', 'functions', 'halt', 'killall', 'single', 'linuxconf', 'boot', 'reboot'] - @not_services = ['functions', 'halt', 'killall', 'single', 'linuxconf', 'reboot', 'boot'] + @services = ['one', 'two', 'three', 'four'] Dir.stubs(:entries).returns @services FileTest.stubs(:directory?).returns(true) FileTest.stubs(:executable?).returns(true) end + it "should return instances for all services" do - (@services-@not_services).each do |inst| + (@services).each do |inst| @class.expects(:new).with{|hash| hash[:name] == inst && hash[:path] == '/etc/init.d'}.returns("#{inst}_instance") end - results = (@services-@not_services).collect {|x| "#{x}_instance"} + results = (@services).collect {|x| "#{x}_instance"} @class.instances.should == results end + it "should call service status when initialized from provider" do @resource.stubs(:[]).with(:status).returns nil @provider.stubs(:get).with(:hasstatus).returns true