Build conditions with DSL evaluated tests:
In Condition: * Modify constructor to accepts tests and a default return value; * Implement #met?; * Modify #! so that it return the negated value returned by #met?. In Condition::DSL: * Modify .evaluate to build the condition with tests and the value returned by a the evaluated condition block. Add a basic Test base class, with env and arguments as attributes. Add some spec helpers to build some easily testable kind of Test instances (as test doubles).
This commit is contained in:
30
spec/producer/core/test_spec.rb
Normal file
30
spec/producer/core/test_spec.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require 'spec_helper'
|
||||
|
||||
module Producer::Core
|
||||
describe Test do
|
||||
let(:env) { double 'env' }
|
||||
let(:arguments) { [:some, :arguments] }
|
||||
subject(:action) { Test.new(env, *arguments) }
|
||||
|
||||
describe '#initialize' do
|
||||
it 'assigns the env' do
|
||||
expect(action.instance_eval { @env }).to be env
|
||||
end
|
||||
it 'assigns the arguments' do
|
||||
expect(action.instance_eval { @arguments }).to eq arguments
|
||||
end
|
||||
end
|
||||
|
||||
describe '#env' do
|
||||
it 'returns the assigned env' do
|
||||
expect(action.env).to be env
|
||||
end
|
||||
end
|
||||
|
||||
describe '#arguments' do
|
||||
it 'returns the assigned arguments' do
|
||||
expect(action.arguments).to eq arguments
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user