# encoding: utf-8 require 'spec_helper' describe Actions::CreateOutput do context '#initialize' do it 'requires template, data and output' do output = double('IO') repository = double('TemplateRepository') data = double('Data') engine_klass = Class.new do def initialize(data) end def compile(template, destination) end end Actions::CreateOutput.new(:template, output, data, engine_klass, repository) end end context '#run' do it 'runs the action' do output = double('$stdout') repository = double('TemplateRepository') expect(repository).to receive(:find).with(:template) data = double('Data') engine_klass = Class.new do def initialize(data) end def compile(template, destination) end end silence(:stderr) do Actions::CreateOutput.new(:template, output, data, engine_klass, repository).run end end end end