Sha256: 1a00491713ff769915d1453570dbc5665b115766475e8f5a4bec8b0a792ba62d

Contents?: true

Size: 1.88 KB

Versions: 7

Compression:

Stored size: 1.88 KB

Contents

require 'spec_helper'


describe 'litmusctl' do
  def _litmusctl(args)
    `bundle exec ruby -I lib bin/litmusctl #{args} -c #{TEST_CONFIG}`
  end

  before(:all) do
    system "bundle exec ruby -I lib bin/litmus -d -c #{TEST_CONFIG} -P /tmp/litmus.pid"
  end

  after(:all) do
    system "kill -9 `cat /tmp/litmus.pid`"
  end

  describe 'help' do
    it "is displayed if no command is given" do
      _litmusctl('').should match("Commands:")
    end
  end

  describe 'list' do
    it "returns the list of services running" do
      _litmusctl('list').should match("test")
    end
  end

  describe 'status' do
    it 'returns the status of a service' do
      _litmusctl('status test').should match("Health: 0")
      _litmusctl('status passing_test').should match(/Health: \d\d/)
    end

    it "returns 'NOT FOUND' for a service that doesn't exist" do
      _litmusctl('status unknown').should match('NOT FOUND')
    end
  end

  describe "force" do
    it "can create a global downfile" do
      _litmusctl('force down -r "for testing"').should match("File created")

      status = _litmusctl('status test')
      status.should match(/Health: 0/)
      status.should match(/for testing/)
    end

    it "creates a downfile" do
      _litmusctl('force down test -r "for testing"').should match("File created")

      status = _litmusctl('status test')
      status.should match(/Health: 0/)
      status.should match(/for testing/)
    end

    it 'removes an upfile for the service' do
      _litmusctl('force up test -r "for testing"').should match("File created")
      _litmusctl('force up test -d').should match("File deleted")

      status = _litmusctl('status passing_test')
      status.should match(/Health: \d\d/)
      status.should_not match(/for testing/)
    end

    it "returns not found if downfile doesn't exist" do
      _litmusctl('force down test -d').should match("NOT FOUND")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
litmus_paper-0.7.5 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.7.4 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.7.3 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.7.2 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.7.1 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.7.0 spec/litmus_paper/cli/admin_spec.rb
litmus_paper-0.6.3 spec/litmus_paper/cli/admin_spec.rb