Sha256: 6a805b272363dc963afab8c32600228ca22074e2ea7eab9326788e87e20e9ac8

Contents?: true

Size: 785 Bytes

Versions: 8

Compression:

Stored size: 785 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

8 entries across 8 versions & 1 rubygems

Version Path
hss-1.0.1 spec/helpers/command_spec.rb
hss-1.0.0 spec/helpers/command_spec.rb
hss-0.2.11 spec/helpers/command_spec.rb
hss-0.2.10 spec/helpers/command_spec.rb
hss-0.2.9 spec/helpers/command_spec.rb
hss-0.2.8 spec/helpers/command_spec.rb
hss-0.2.6 spec/helpers/command_spec.rb
hss-0.2.5 spec/helpers/command_spec.rb