From fe1eb5bc1a033285c4807f40385aa41a6b309140 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 19 Dec 2013 20:34:46 +0000 Subject: [PATCH] Simplify actions specs --- spec/producer/core/actions/echo_spec.rb | 6 +----- spec/producer/core/actions/shell_command_spec.rb | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/spec/producer/core/actions/echo_spec.rb b/spec/producer/core/actions/echo_spec.rb index 954a651..0fc02d7 100644 --- a/spec/producer/core/actions/echo_spec.rb +++ b/spec/producer/core/actions/echo_spec.rb @@ -2,15 +2,11 @@ require 'spec_helper' module Producer::Core describe Actions::Echo do - let(:env) { Env.new } + let(:env) { double 'env' } let(:text) { 'hello' } subject(:echo) { Actions::Echo.new(env, text) } describe '#apply' do - before do - env.output = StringIO.new - end - it 'outputs the string given as argument through env.output' do expect(env).to receive(:output).with(text) echo.apply diff --git a/spec/producer/core/actions/shell_command_spec.rb b/spec/producer/core/actions/shell_command_spec.rb index f4975be..8022bf4 100644 --- a/spec/producer/core/actions/shell_command_spec.rb +++ b/spec/producer/core/actions/shell_command_spec.rb @@ -8,9 +8,7 @@ module Producer::Core subject(:sh) { Actions::ShellCommand.new(env, command) } describe '#apply' do - before do - env.output = StringIO.new - end + before { env.output = StringIO.new } it 'delegates the call to env.remote.execute method' do expect(env.remote).to receive(:execute).with(command)