Sha256: 3310a3866e8718a0f20a3592514399bc931ff6e7ad178f0e0f0670235cf1669f

Contents?: true

Size: 1.12 KB

Versions: 18

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Mina::Runner do
  let(:instance) { Mina::Configuration.instance }

  describe '#initialize' do
    it 'raises an error if execution mode is not set' do
      instance.remove(:execution_mode)
      expect { Mina::Runner.new(nil, nil) }.to raise_error('You must specify execution mode')
    end

    it 'raises an error when run on windows and pretty print' do
      instance.set(:execution_mode, :pretty)
      allow(Gem::Platform.local).to receive(:os).and_return(:windows)
      expect { Mina::Runner.new(nil, nil) }.to raise_error('Unsuported execution mode (pretty on windows)')
    end

    it 'sets execution mode to printer if simulate is true' do
      instance.set(:execution_mode, :pretty)
      instance.set(:simulate, :true)
      expect(Mina::Runner.new(nil, nil).execution_mode).to eq(:printer)
      instance.remove(:simulate)
    end
  end

  describe '#run' do
    it 'runs the commands on a backend' do
      instance.set(:execution_mode, :printer)
      runner = Mina::Runner.new(['ls -al'], :local)
      expect { runner.run }.to output("\\[\\\"ls\\ -al\\\"\\]\n").to_stdout
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mina-1.2.4 spec/lib/mina/runner_spec.rb
mina-1.2.3 spec/lib/mina/runner_spec.rb
mina-1.2.2 spec/lib/mina/runner_spec.rb
mina-1.2.1 spec/lib/mina/runner_spec.rb
mina-1.2.0 spec/lib/mina/runner_spec.rb
mina-1.1.1 spec/lib/mina/runner_spec.rb
mina-1.1.0 spec/lib/mina/runner_spec.rb
mina-1.0.7 spec/lib/mina/runner_spec.rb
mina-1.0.6 spec/lib/mina/runner_spec.rb
mina-1.0.5 spec/lib/mina/runner_spec.rb
mina-1.0.4 spec/lib/mina/runner_spec.rb
mina-1.0.3 spec/lib/mina/runner_spec.rb
mina-1.0.2 spec/lib/mina/runner_spec.rb
mina-1.0.0 spec/lib/mina/runner_spec.rb
mina-1.0.0.rc2 spec/lib/mina/runner_spec.rb
mina-1.0.0.beta5 spec/lib/mina/runner_spec.rb
mina-1.0.0.beta4 spec/lib/mina/runner_spec.rb
mina-1.0.0.beta3 spec/lib/mina/runner_spec.rb