Remove Task::DSL.evaluate method

This commit is contained in:
Thibault Jouan
2013-12-20 11:43:18 +00:00
parent 366c682152
commit 43a781dc78
4 changed files with 28 additions and 50 deletions

View File

@@ -12,42 +12,6 @@ module Producer::Core
end
end
describe '.evaluate' do
let(:name) { :some_task }
it 'builds a new DSL sandbox with given code' do
dsl = double('dsl').as_null_object
expect(Task::DSL).to receive(:new).with(no_args) do |&b|
expect(b).to be block
dsl
end
Task::DSL.evaluate(name, env, &block)
end
it 'evaluates the DSL sandbox code with given environment' do
dsl = double('dsl').as_null_object
allow(Task::DSL).to receive(:new) { dsl }
expect(dsl).to receive(:evaluate).with(env)
Task::DSL.evaluate(name, env, &block)
end
it 'builds a task with its name, actions and condition' do
dsl = double(
'dsl', actions: [:some_action], condition: :some_condition
).as_null_object
allow(Task::DSL).to receive(:new) { dsl }
expect(Task)
.to receive(:new).with(:some_task, [:some_action], :some_condition)
Task::DSL.evaluate(name, env, &block)
end
it 'returns the task' do
task = double 'task'
allow(Task).to receive(:new) { task }
expect(Task::DSL.evaluate(name, env, &block)).to be task
end
end
describe '.define_action' do
it 'defines a new action keyword' do
Task::DSL.define_action(:some_action, Object)