Replaces Proc.new usages with proc keyword
This commit is contained in:
parent
57ff1c73be
commit
836f9ffc29
@ -4,7 +4,7 @@ module Producer::Core
|
|||||||
describe Recipe::DSL do
|
describe Recipe::DSL do
|
||||||
include FixturesHelpers
|
include FixturesHelpers
|
||||||
|
|
||||||
let(:code) { Proc.new { } }
|
let(:code) { proc { } }
|
||||||
let(:env) { double('env').as_null_object }
|
let(:env) { double('env').as_null_object }
|
||||||
subject(:dsl) { Recipe::DSL.new &code }
|
subject(:dsl) { Recipe::DSL.new &code }
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when a code block is given as argument' do
|
context 'when a code block is given as argument' do
|
||||||
subject(:dsl) { Recipe::DSL.new Proc.new { } }
|
subject(:dsl) { Recipe::DSL.new proc { } }
|
||||||
|
|
||||||
it 'returns the DSL instance' do
|
it 'returns the DSL instance' do
|
||||||
expect(dsl).to be_a Recipe::DSL
|
expect(dsl).to be_a Recipe::DSL
|
||||||
@ -77,7 +77,7 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#tasks' do
|
describe '#tasks' do
|
||||||
let(:code) { Proc.new { task(:some_task) } }
|
let(:code) { proc { task(:some_task) } }
|
||||||
|
|
||||||
it 'returns registered tasks' do
|
it 'returns registered tasks' do
|
||||||
expect(dsl.tasks[0].name).to eq :some_task
|
expect(dsl.tasks[0].name).to eq :some_task
|
||||||
@ -85,7 +85,7 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#task' do
|
describe '#task' do
|
||||||
let(:code) { Proc.new { task(:first); task(:last) } }
|
let(:code) { proc { task(:first); task(:last) } }
|
||||||
|
|
||||||
it 'registers tasks in declaration order' do
|
it 'registers tasks in declaration order' do
|
||||||
expect(dsl.tasks[0].name).to eq :first
|
expect(dsl.tasks[0].name).to eq :first
|
||||||
|
@ -6,7 +6,7 @@ module Producer::Core
|
|||||||
subject(:dsl) { Task::DSL.new &block }
|
subject(:dsl) { Task::DSL.new &block }
|
||||||
|
|
||||||
describe '#evaluate' do
|
describe '#evaluate' do
|
||||||
let(:block) { Proc.new { raise 'error from task' } }
|
let(:block) { proc { raise 'error from task' } }
|
||||||
|
|
||||||
it 'evaluates its code' do
|
it 'evaluates its code' do
|
||||||
expect { dsl.evaluate(env) }
|
expect { dsl.evaluate(env) }
|
||||||
@ -16,7 +16,7 @@ module Producer::Core
|
|||||||
|
|
||||||
describe '#condition' do
|
describe '#condition' do
|
||||||
context 'when met (block evals to true)' do
|
context 'when met (block evals to true)' do
|
||||||
let(:block) { Proc.new {
|
let(:block) { proc {
|
||||||
condition { true }
|
condition { true }
|
||||||
raise 'error after condition'
|
raise 'error after condition'
|
||||||
} }
|
} }
|
||||||
@ -28,7 +28,7 @@ module Producer::Core
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when not met (block evals to false)' do
|
context 'when not met (block evals to false)' do
|
||||||
let(:block) { Proc.new {
|
let(:block) { proc {
|
||||||
condition { false }
|
condition { false }
|
||||||
raise
|
raise
|
||||||
} }
|
} }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user