Implement `target' recipe keyword

This commit is contained in:
Thibault Jouan 2014-09-25 01:24:25 +00:00
parent 8fd387b41f
commit a7b2c4abea
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,11 @@
Feature: `target' task keyword
Scenario: returns the current target
Given a recipe with:
"""
target 'some_host.example'
task(:echo_target) { echo target }
"""
When I execute the recipe
Then the output must contain "some_host.example"

View File

@ -13,6 +13,9 @@ module Producer
end
end
extend Forwardable
def_delegators :@env, :target
define_action :echo, Actions::Echo
define_action :sh, Actions::ShellCommand

View File

@ -159,5 +159,13 @@ module Producer::Core
expect(task.get :some_key).to eq :some_value
end
end
describe '#target' do
before { env.target = :some_target }
it 'returns current env target' do
expect(task.target).to eq :some_target
end
end
end
end