Sha256: d74ea2284fc22c3e3d9cd84a7958cfe4eb467c993390b79f1f0c90c01d688e44

Contents?: true

Size: 1.8 KB

Versions: 37

Compression:

Stored size: 1.8 KB

Contents

shared_examples_for 'support service enabled matcher' do |valid_service|
  describe 'be_enabled' do
    describe service(valid_service) do
      it { should be_enabled }
    end

    describe service('invalid-service') do
      it { should_not be_enabled }
    end
  end
end

shared_examples_for 'support service running matcher' do |valid_service|
  describe 'be_running' do
    describe service(valid_service) do
      it { should be_running }
    end

    describe service('invalid-daemon') do
      it { should_not be_running }
    end

    describe service(valid_service) do
      before :all do
        RSpec.configure do |c|
          c.stdout = "#{valid_service} is stopped\r\n"
        end
      end
      it { should be_running }
    end
  end
end

shared_examples_for 'support service running under supervisor matcher' do |valid_service|
  describe 'be_running.under("supervisor")' do
    describe service(valid_service) do
      before :all do
        RSpec.configure do |c|
          c.stdout = "#{valid_service} RUNNING\r\n"
        end
      end

      it { should be_running.under('supervisor') }
    end

    describe service(valid_service) do
      before :all do
        RSpec.configure do |c|
          c.stdout = "#{valid_service} STOPPED\r\n"
        end
      end

      it { should_not be_running.under('supervisor') }
    end

    describe service('invalid-daemon') do
      it { should_not be_running.under('supervisor') }
    end
  end
end

shared_examples_for 'support service running under unimplemented matcher' do |valid_service|
  describe 'be_running.under("not implemented")' do
    describe service(valid_service) do
      it {
        expect {
          should be_running.under('not implemented')
        }.to raise_error(ArgumentError, %r/\A`be_running` matcher doesn\'t support/)
      }
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
serverspec-0.6.12 spec/support/shared_service_examples.rb
serverspec-0.6.11 spec/support/shared_service_examples.rb
serverspec-0.6.10 spec/support/shared_service_examples.rb
serverspec-0.6.9 spec/support/shared_service_examples.rb
serverspec-0.6.8 spec/support/shared_service_examples.rb
serverspec-0.6.7 spec/support/shared_service_examples.rb
serverspec-0.6.6 spec/support/shared_service_examples.rb
serverspec-0.6.5 spec/support/shared_service_examples.rb
serverspec-0.6.4 spec/support/shared_service_examples.rb
serverspec-0.6.3 spec/support/shared_service_examples.rb
serverspec-0.6.2 spec/support/shared_service_examples.rb
serverspec-0.6.1 spec/support/shared_service_examples.rb
serverspec-0.6.0 spec/support/shared_service_examples.rb
serverspec-0.5.8 spec/support/shared_service_examples.rb
serverspec-0.5.7 spec/support/shared_service_examples.rb
serverspec-0.5.6 spec/support/shared_service_examples.rb
serverspec-0.5.5 spec/support/shared_service_examples.rb
serverspec-0.5.4 spec/support/shared_service_examples.rb
serverspec-0.5.3 spec/support/shared_service_examples.rb
serverspec-0.5.2 spec/support/shared_service_examples.rb