spec/lib/mina/commands_spec.rb in mina-1.2.4 vs spec/lib/mina/commands_spec.rb in mina-1.2.5

- old
+ new

@@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'spec_helper' describe Mina::Commands do - let(:commands) { Mina::Commands.new(:default) } + let(:commands) { described_class.new(:default) } describe '#command' do it 'adds a command to the queue' do commands.command('ls -al') @@ -16,11 +18,10 @@ expect(commands.queue[:default]).to include(' ls -al') end context 'when verbose' do before { Mina::Configuration.instance.set(:verbose, true) } - after { Mina::Configuration.instance.remove(:verbose) } it 'adds a echo command to the queue' do commands.command('ls -al') expect(commands.queue[:default]).to include("echo \\$\\ ls\\ -al &&\nls -al") @@ -71,23 +72,22 @@ expect(commands.process('some/path')).to eq('(cd some/path && ls -al && pwd && cd -)') end context 'when verbose' do before { Mina::Configuration.instance.set(:verbose, true) } - after { Mina::Configuration.instance.remove(:verbose) } it 'joins all the commands within a path and echoes it' do - expect(commands.process('some/path')).to eq("(cd some/path && echo \"$ cd some/path\" && ls -al && pwd && cd -)") + expect(commands.process('some/path')).to eq('(cd some/path && echo "$ cd some/path" && ls -al && pwd && cd -)') end end end describe '#run' do - it 'calls run on a backend' do + it 'calls run on a backend', :suppressed_output do commands.command('ls -al') - runner = double(:runner) + runner = instance_double(Mina::Runner) allow(Mina::Runner).to receive(:new).and_return(runner) - expect(runner).to receive(:run).and_return(true) + allow(runner).to receive(:run).and_return(true) commands.run(:local) end end end