summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorMarc A. Paradise <marc.paradise@gmail.com>2019-04-30 14:11:54 -0400
committerMarc A. Paradise <marc.paradise@gmail.com>2019-05-02 12:44:29 -0400
commite177c05fb6f0e3d0bd4fb0d905842ef71e508614 (patch)
tree0227c397fa101e78bf2f83a984dc138fe6f95f0b /spec/unit
parent1c0a097bd1f9f55d4db199b0681afd68f52c218e (diff)
downloadchef-e177c05fb6f0e3d0bd4fb0d905842ef71e508614.tar.gz
Remove testing method TrainConnector#test_instance
This can live in the tests. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb29
1 files changed, 17 insertions, 12 deletions
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index 08bf21dd42..c976a805ee 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -20,7 +20,7 @@ require "ostruct"
require "chef/knife/bootstrap/train_connector"
describe Chef::Knife::Bootstrap::TrainConnector do
- let(:protocol) { "mock" }
+ let(:transport) { "mock" }
let(:family) { "unknown" }
let(:release) { "unknown" } # version
let(:name) { "unknown" }
@@ -28,17 +28,18 @@ describe Chef::Knife::Bootstrap::TrainConnector do
let(:host_url) { "mock://user1@example.com" }
let(:opts) { {} }
subject do
- # Create a valid TargetHost with the backend stubbed out.
- Chef::Knife::Bootstrap::TrainConnector.test_instance(host_url,
- protocol: protocol,
- family: family,
- name: name,
- release: release,
- arch: arch,
- opts: opts)
- end
-
- context "connect!" do
+ # Specifying sudo: false ensures that attempted operations
+ # don't fail because the mock platform doesn't support sudo.
+ # Example groups can still override by setting explicitly it in 'opts'
+ tc = Chef::Knife::Bootstrap::TrainConnector.new(host_url, transport, { sudo: false }.merge(opts))
+ tc.connect!
+ tc.connection.mock_os(
+ family: family,
+ name: name,
+ release: release,
+ arch: arch
+ )
+ tc
end
describe "platform helpers" do
@@ -78,6 +79,10 @@ describe Chef::Knife::Bootstrap::TrainConnector do
end
end
+ describe "::new" do
+
+ end
+
describe "#temp_dir" do
context "under windows" do
let(:family) { "windows" }