Add Condition::DSL#{block,env} attribute readers
This commit is contained in:
parent
db6f22ac97
commit
f27ab6f074
@ -16,7 +16,7 @@ module Producer
|
|||||||
define_test :has_env, Tests::HasEnv
|
define_test :has_env, Tests::HasEnv
|
||||||
define_test :has_file, Tests::HasFile
|
define_test :has_file, Tests::HasFile
|
||||||
|
|
||||||
attr_reader :tests
|
attr_reader :block, :env, :tests
|
||||||
|
|
||||||
def initialize(env, &block)
|
def initialize(env, &block)
|
||||||
@env = env
|
@env = env
|
||||||
|
@ -27,12 +27,12 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#initialize' do
|
describe '#initialize' do
|
||||||
it 'assigns the code' do
|
it 'assigns the env' do
|
||||||
expect(dsl.instance_eval { @block }).to be block
|
expect(dsl.env).to be env
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'assigns the env' do
|
it 'assigns the code' do
|
||||||
expect(dsl.instance_eval { @env }).to be env
|
expect(dsl.block).to be block
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'assigns no test' do
|
it 'assigns no test' do
|
||||||
@ -40,13 +40,6 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#tests' do
|
|
||||||
it 'returns the assigned tests' do
|
|
||||||
dsl.instance_eval { @tests = [:some_test] }
|
|
||||||
expect(dsl.tests).to eq [:some_test]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#evaluate' do
|
describe '#evaluate' do
|
||||||
it 'returns the value returned by the assigned block' do
|
it 'returns the value returned by the assigned block' do
|
||||||
expect(dsl.evaluate).to eq block.call
|
expect(dsl.evaluate).to eq block.call
|
||||||
|
Loading…
x
Reference in New Issue
Block a user