~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to spec/unit/provider/service/smf_spec.rb

  • Committer: Benjamin Kerensa
  • Date: 2012-11-21 23:50:52 UTC
  • mfrom: (1.1.30)
  • Revision ID: bkerensa@ubuntu.com-20121121235052-ah7nzabp77sh69gb
New Upstream Release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env rspec
 
1
#! /usr/bin/env ruby
2
2
#
3
3
# Unit testing for the SMF service Provider
4
4
#
22
22
    FileTest.stubs(:executable?).with('/usr/bin/svcs').returns true
23
23
  end
24
24
 
 
25
  describe ".instances" do
 
26
    it "should have an instances method" do
 
27
      provider_class.should respond_to :instances
 
28
    end
 
29
 
 
30
    it "should get a list of services (excluding legacy)" do
 
31
      provider_class.expects(:svcs).with().returns File.read(my_fixture('svcs.out'))
 
32
      instances = provider_class.instances.map { |p| {:name => p.get(:name), :ensure => p.get(:ensure)} }
 
33
      # we dont manage legacy
 
34
      instances.size.should == 2
 
35
      instances[0].should == {:name => 'svc:/system/svc/restarter:default', :ensure => :running }
 
36
      instances[1].should == {:name => 'svc:/network/cswrsyncd:default', :ensure => :maintenance }
 
37
    end
 
38
  end
 
39
 
25
40
  it "should have a restart method" do
26
41
    @provider.should respond_to(:restart)
27
42
  end