Rename Worker class as Interpreter

This commit is contained in:
Thibault Jouan
2013-08-16 19:30:51 +00:00
parent 5a4c8c02bc
commit e4a4211a7b
5 changed files with 20 additions and 20 deletions

View File

@@ -27,9 +27,9 @@ module Producer::Core
cli.run!
end
it 'processes the tasks with the worker' do
it 'processes the tasks with the interpreter' do
allow(cli.recipe).to receive(:tasks) { [:some_task] }
expect(cli.worker).to receive(:process).with([:some_task])
expect(cli.interpreter).to receive(:process).with([:some_task])
cli.run!
end
end
@@ -86,16 +86,16 @@ module Producer::Core
end
end
describe '#worker' do
it 'builds a worker' do
expect(Worker).to receive(:new)
cli.worker
describe '#interpreter' do
it 'builds a interpreter' do
expect(Interpreter).to receive(:new)
cli.interpreter
end
it 'returns the worker' do
worker = double('worker')
allow(Worker).to receive(:new) { worker }
expect(cli.worker).to be worker
it 'returns the interpreter' do
interpreter = double('interpreter')
allow(Interpreter).to receive(:new) { interpreter }
expect(cli.interpreter).to be interpreter
end
end
end

View File

@@ -1,13 +1,13 @@
require 'spec_helper'
module Producer::Core
describe Worker do
subject(:worker) { Worker.new }
describe Interpreter do
subject(:interpreter) { Interpreter.new }
describe '#process' do
it 'processes each task' do
expect(worker).to receive(:process_task).with(:some_task)
worker.process [:some_task]
expect(interpreter).to receive(:process_task).with(:some_task)
interpreter.process [:some_task]
end
end
@@ -17,7 +17,7 @@ module Producer::Core
task = double('task')
allow(task).to receive(:actions) { [action] }
expect(action).to receive(:apply)
worker.process_task(task)
interpreter.process_task(task)
end
end
end