Skip to content

Commit

Permalink
modify redhat_instance provider tests to work with 2.7.x
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Joshua Hoblitt committed Feb 13, 2014
1 parent ba78c67 commit 05cd337
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions spec/unit/provider/service/redhat_instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 05cd337

Please sign in to comment.