Implement Task::DSL#evaluate:

So that the env is available from the task DSL.
This commit is contained in:
Thibault Jouan
2013-07-30 23:24:28 +00:00
parent a45a340b64
commit ace6a4ad2b
6 changed files with 28 additions and 12 deletions

View File

@@ -2,13 +2,15 @@ require 'spec_helper'
module Producer::Core
describe Task::DSL do
let(:env) { double('env') }
subject(:dsl) { Task::DSL.new &block }
describe '#initialize' do
describe '#evaluate' do
let(:block) { Proc.new { raise 'error from task' } }
it 'evaluates its block' do
expect { dsl }.to raise_error(RuntimeError, 'error from task')
it 'evaluates its code' do
expect { dsl.evaluate(env) }
.to raise_error(RuntimeError, 'error from task')
end
end
@@ -20,7 +22,8 @@ module Producer::Core
} }
it 'evaluates all the block' do
expect { dsl }.to raise_error(RuntimeError, 'error after condition')
expect { dsl.evaluate(env) }
.to raise_error(RuntimeError, 'error after condition')
end
end
@@ -31,7 +34,7 @@ module Producer::Core
} }
it 'stops block evaluation' do
expect { dsl }.not_to raise_error
expect { dsl.evaluate(env) }.not_to raise_error
end
end
end