From 70109615c8548df3947a5221dbbcfc6f8785faf4 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Mon, 20 Jan 2014 22:26:58 +0000 Subject: [PATCH] Implement Action#input, delegating to env input --- lib/producer/core/action.rb | 2 +- spec/producer/core/action_spec.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/producer/core/action.rb b/lib/producer/core/action.rb index 4a40a09..0c3381e 100644 --- a/lib/producer/core/action.rb +++ b/lib/producer/core/action.rb @@ -4,7 +4,7 @@ module Producer require 'forwardable' extend Forwardable - def_delegators :@env, :output, :remote + def_delegators :@env, :input, :output, :remote def_delegators :remote, :fs attr_reader :env, :arguments diff --git a/spec/producer/core/action_spec.rb b/spec/producer/core/action_spec.rb index 39137d9..7ac25bf 100644 --- a/spec/producer/core/action_spec.rb +++ b/spec/producer/core/action_spec.rb @@ -2,8 +2,9 @@ require 'spec_helper' module Producer::Core describe Action do + let(:input) { StringIO.new } let(:output) { StringIO.new } - let(:env) { Env.new(output: output) } + let(:env) { Env.new(input: input, output: output) } let(:arguments) { [:some, :arguments] } subject(:action) { Action.new(env, *arguments) } @@ -19,6 +20,12 @@ module Producer::Core end end + describe '#input' do + it 'returns env input' do + expect(action.input).to be input + end + end + describe '#output' do it 'delegates to env output' do action.output.puts 'some content'