Sha256: b2189d08d3b466aa00f3f878a4e16b9c657f1149ceb22faa9a1757d829b8de88

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

describe HSS::Parser do
  let(:config) { 'spec/test/config.yml' }
  let(:handler) { HSS::Handler.new config }

  describe '#command' do
    it 'runs shell commands' do
      expect(handler.handle('cmd_bar')).to eql 'bar@example.org'
    end
    context 'if the command is invalid' do
      it 'raises an error' do
        expect { handler.handle 'failcmd_zsxdcf' }.to raise_error RuntimeError
      end
    end
    context 'if the command is not executable' do
      it 'raises an error' do
        expect { handler.handle 'failcmd_LICENSE' }.to raise_error RuntimeError
      end
    end
    context 'if the command fails' do
      it 'raises an error' do
        expect { handler.handle 'failcmd_false' }.to raise_error RuntimeError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hss-1.1.0 spec/helpers/command_spec.rb