Sha256: 8abfce709cccea77725dc8378d0ff6f886cf62f30e7bb659b51c204f92902dd5

Contents?: true

Size: 826 Bytes

Versions: 15

Compression:

Stored size: 826 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe Runner do
  context '#initialize' do
    it 'expects a command string' do
      Runner.new('echo')
    end

  end

  context '#run' do
    it 'runs a command' do
      runner = Runner.new('echo')
      expect {
        runner.run
      }.not_to raise_error
    end

    it 'fails on error file not found' do
      runner = Runner.new('asdfasdf asfd')
      expect {
        runner.run
      }.to raise_error RuntimeError
    end

    it 'fails on error status code' do
      runner = Runner.new('exit 1')
      expect {
        runner.run
      }.to raise_error RuntimeError
    end
  end

  context '#result' do
    it 'returns stdout as array' do
      runner = Runner.new("echo -E \"hello\nworld\"")

      expect(runner.result).to eq(["hello", "world"])
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
local_pac-0.1.13 spec/runner_spec.rb
local_pac-0.1.11 spec/runner_spec.rb
local_pac-0.1.10 spec/runner_spec.rb
local_pac-0.1.9 spec/runner_spec.rb
local_pac-0.1.8 spec/runner_spec.rb
local_pac-0.1.7 spec/runner_spec.rb
local_pac-0.1.6 spec/runner_spec.rb
local_pac-0.1.5 spec/runner_spec.rb
local_pac-0.1.4 spec/runner_spec.rb
git_hook-pre_receive-0.1.0 spec/runner_spec.rb
local_pac-0.1.3 spec/runner_spec.rb
local_pac-0.1.2 spec/runner_spec.rb
local_pac-0.1.1 spec/runner_spec.rb
local_pac-0.1.0 spec/runner_spec.rb
git_hook-pre_receive-0.0.2 spec/runner_spec.rb