Introduce Env to manage CLI env and config

This commit is contained in:
Thibault Jouan
2015-04-07 23:13:28 +00:00
parent 12075323c5
commit 304db803f3
5 changed files with 81 additions and 19 deletions

30
spec/uh/wm/env_spec.rb Normal file
View File

@@ -0,0 +1,30 @@
module Uh
module WM
RSpec.describe Env do
let(:output) { StringIO.new }
let(:logger) { Logger.new(StringIO.new) }
subject(:env) { described_class.new output, logger_: logger }
describe '#logger' do
it 'returns a logger' do
expect(env.logger).to be_a ::Logger
end
end
describe '#log' do
it 'logs given message at info level' do
expect(logger).to receive(:info).with 'some message'
env.log 'some message'
end
end
describe '#print' do
it 'prints the message to the output' do
env.print 'some message'
expect(output.string).to eq 'some message'
end
end
end
end
end