Simplify Remote::Environment with factory method:

* Implement .new_from_string factory class method;
* Rename private method #parse_from_string as class method
  .string_to_hash;
* Remove argument kind detection logic in constructor.
This commit is contained in:
Thibault Jouan
2013-12-21 03:08:01 +00:00
parent 4885483d75
commit 012c776880
4 changed files with 34 additions and 25 deletions

View File

@@ -128,13 +128,13 @@ module Producer::Core
end
it 'builds a remote environment with the result of `env` command' do
expect(Remote::Environment).to receive(:new).with(output)
expect(Remote::Environment).to receive(:new_from_string).with(output)
remote.environment
end
it 'returns the environment' do
environment = double 'environment'
allow(Remote::Environment).to receive(:new) { environment }
allow(Remote::Environment).to receive(:new_from_string) { environment }
expect(remote.environment).to be environment
end
end