require 'spec_helper' def plist <<-EOS EOS end describe Girdle do describe '::run' do it 'must call xgrid with default options' do Girdle.expects(:`). with('/usr/bin/xgrid -hostname localhost -auth None -format xml -failover YES -autocopy YES'). returns(plist) Girdle.run end it 'must format commands and arguments' do Girdle.expects(:`). with('/usr/bin/xgrid -hostname localhost -auth None -format xml -failover YES -autocopy YES -job run /bin/echo hello'). returns(plist) Girdle.run(job: 'run', cmd: '/bin/echo hello') end end describe '::run_batch' do it 'must pipe xml to xgrid using - argument' do Girdle.expects(:`). with('echo "xml" | /usr/bin/xgrid -hostname localhost -auth None -format xml -failover YES -autocopy YES -'). returns(plist) Girdle.run_batch('xml') end end end