Improve small details in specs:
* Fix coding standards; * Simplify some expectations (eq instead of be matcher); * Expect identity on block instead of calling; * Change some before call as oneliners; * Avoid shadowing variable names; * Improve wording where needed.
This commit is contained in:
		| @@ -3,24 +3,24 @@ require 'spec_helper' | ||||
| module Producer::Core | ||||
|   describe Task do | ||||
|     let(:name)      { :some_task } | ||||
|     let(:action)    { double('action') } | ||||
|     let(:condition) { double('condition') } | ||||
|     let(:action)    { double 'action' } | ||||
|     let(:condition) { double 'condition' } | ||||
|     subject(:task)  { Task.new(name, [action], condition) } | ||||
|  | ||||
|     describe '.evaluate' do | ||||
|       let(:env)   { double('env') } | ||||
|       let(:block) { proc { :some_value } } | ||||
|       let(:env)   { double 'env' } | ||||
|       let(:block) { proc { :some_task_code } } | ||||
|  | ||||
|       it 'delegates to DSL.evaluate' do | ||||
|         expect(Task::DSL) | ||||
|           .to receive(:evaluate).with(name, env) do |&b| | ||||
|             expect(b.call).to eq :some_value | ||||
|             expect(b).to be block | ||||
|           end | ||||
|         Task.evaluate(name, env, &block) | ||||
|       end | ||||
|  | ||||
|       it 'returns the evaluated task' do | ||||
|         task = double('task') | ||||
|         task = double 'task' | ||||
|         allow(Task::DSL).to receive(:evaluate) { task } | ||||
|         expect(Task.evaluate(name, env, &block)).to be task | ||||
|       end | ||||
| @@ -40,7 +40,7 @@ module Producer::Core | ||||
|       end | ||||
|  | ||||
|       context 'when only the name is given as argument' do | ||||
|         subject(:task)  { Task.new(name) } | ||||
|         subject(:task) { Task.new(name) } | ||||
|  | ||||
|         it 'assigns no action' do | ||||
|           expect(task.actions).to be_empty | ||||
|   | ||||
		Reference in New Issue
	
	Block a user