Sha256: 145c38883d60d30ada18ec1d80280d9037bd4b9c9f4e19aab6597e55beb49253

Contents?: true

Size: 999 Bytes

Versions: 3

Compression:

Stored size: 999 Bytes

Contents

describe Chicanery do
  include Chicanery

  describe '#execute' do
    before { %w{load restore persist}.each {|m| stub! m } }

    after { execute ['configuration'] }

    it 'should load configuration and exit immediately when nothing is configured no poll period is provided' do
      should_receive(:load).with 'configuration'
    end

    it 'should restore previous state' do
      should_receive(:restore)
    end

    it 'should persist new state' do
      should_receive(:persist).with({
        servers: {},
        repos: {}
      })
    end

    it 'should sleep for specified time when poll period is provided' do
      should_receive(:sleep).with(10).and_raise Interrupt
      poll_period 10
    end

    it "polls with a specified period" do
      should_receive(:run).exactly(3).times
      should_receive(:sleep).with(10).ordered
      should_receive(:sleep).with(10).ordered
      should_receive(:sleep).with(10).ordered.and_raise Interrupt
      poll_period 10
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chicanery-0.1.0 spec/chicanery_spec.rb
chicanery-0.0.9 spec/chicanery_spec.rb
chicanery-0.0.8 spec/chicanery_spec.rb