1require 'spec_helper' 2require 'mcollective/application/shell/watcher' 3 4module MCollective 5 class Application 6 class Shell < Application 7 describe Watcher do 8 let(:watcher) { Watcher.new('test-node', 'test-handle') } 9 10 describe '#initalize' do 11 it 'should record the node, handle, and zero the offsets' do 12 watcher.node.should == 'test-node' 13 watcher.handle.should == 'test-handle' 14 watcher.stdout_offset.should == 0 15 watcher.stderr_offset.should == 0 16 end 17 end 18 19 describe '#status' do 20 it 'should increment the offsets' do 21 watcher.status({ :data => { :stdout => "four", :stderr => "five " } }) 22 watcher.stdout_offset.should == 4 23 watcher.stderr_offset.should == 5 24 end 25 end 26 27 describe '#flush' do 28 it 'should flush the managed PrefixStreamBufs' do 29 watcher.instance_variable_get(:@stdout).expects(:flush) 30 watcher.instance_variable_get(:@stderr).expects(:flush) 31 watcher.flush 32 end 33 end 34 end 35 end 36 end 37end 38