Refactor Remote::Environment spec with described_class

This commit is contained in:
Thibault Jouan 2014-01-19 19:08:18 +00:00
parent 161c784cbe
commit 22dd5fbdf9

View File

@ -9,21 +9,20 @@ module Producer::Core
describe '.string_to_hash' do describe '.string_to_hash' do
it 'converts key=value pairs separated by new lines to a hash' do it 'converts key=value pairs separated by new lines to a hash' do
expect(Remote::Environment.string_to_hash(string)) expect(described_class.string_to_hash(string)).to eq variables
.to eq variables
end end
end end
describe '.new_from_string' do describe '.new_from_string' do
it 'builds a new instance after converting from string' do it 'builds a new instance after converting from string' do
expect(Remote::Environment).to receive(:new).with(variables) expect(described_class).to receive(:new).with(variables)
Remote::Environment.new_from_string(string) described_class.new_from_string(string)
end end
it 'returns the instance' do it 'returns the instance' do
environment = double 'environment' environment = double 'environment'
allow(Remote::Environment).to receive(:new) { environment } allow(described_class).to receive(:new) { environment }
expect(Remote::Environment.new_from_string(string)).to be environment expect(described_class.new_from_string(string)).to be environment
end end
end end