Sha256: 8ddd4f118532a1f29a7a9d87281642dc6f36d2ac15717ebb303e4ce187fe1e52
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' require 'circle/cli/watcher' module Circle::CLI RSpec.describe Watcher do describe '#display' do it 'invokes the block given in initialize' do displayer = -> {} watcher = described_class.new(&displayer) expect(displayer).to receive(:call).once watcher.display end end describe '#to_preload' do let(:watcher) { described_class.new {} } it 'assigns a preloader block' do preloader = -> {} watcher.to_preload(&preloader) expect(watcher.preloader).to eq(preloader) end end describe '#preload' do let(:watcher) { described_class.new {} } it 'invokes the preloader' do preloader = -> {} watcher.to_preload(&preloader) expect(preloader).to receive(:call) watcher.preload end end describe '#poll' do let(:watcher) { described_class.new {} } it 'displays, sleeps, preloads, then clears the screen and exits on Interrupt' do expect(watcher).to receive(:display).once.ordered expect(watcher).to receive(:sleep).with(42).once.ordered expect(watcher).to receive(:preload).once.ordered expect(watcher).to receive(:clear).and_raise(Interrupt).once.ordered expect { watcher.poll(42) }.to raise_error(SystemExit) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
circle-cli-0.1.3 | spec/circle/cli/watcher_spec.rb |
circle-cli-0.1.2 | spec/circle/cli/watcher_spec.rb |