summaryrefslogtreecommitdiff
path: root/spec/unit/knife
diff options
context:
space:
mode:
authorChef Expeditor <chef-ci@chef.io>2021-03-11 17:45:48 +0000
committerMarc A. Paradise <marc.paradise@gmail.com>2021-03-31 13:52:49 -0400
commit01c6a9e1753bd4b2166efe747151ba8700ebc0f5 (patch)
tree55f16085d89859139211bf6d2b8fd2dbcf4633b0 /spec/unit/knife
parent497dd4af19ea7dff9a72d704a1de8e9be36b2996 (diff)
downloadchef-01c6a9e1753bd4b2166efe747151ba8700ebc0f5.tar.gz
Move knife to its own gem
This moves knife into /knife, in the same way that chef-utils and chef-config are separated. NOTES: == File History == If you see this message as the first message in the history of an knife file, you can see the complete history by using 'git log --follow', 'git config log.follow true' to make it the default behavior in this repository, or 'git config --globa log.follow true' to make it the global default. == API Changes == At the API level, there is one breaking change: CookbookSiteStreamingUploader has been moved out of chef and into knife/core. There were a combination of reasons we chose this path: - CookbookSiteStreamingUploader (CSSU) is only used within Knife. - CookbookSiteStreamingUploader (CSSU) references the command Chef::Knife::CookbookMetadata in order to generate a metadata file for the cookbook to upload - Chef::Knife::CookbookMetadata is no longer available to Chef:: because Knife has been moved to its own gem. Knife gem depends on the Chef gem, so Chef can't depend on something in Knife. A search for usage in related projects (berks, chef-cli) and the Internet at large shows that there are no known external consumers of CSSU. For now, we'll move this class into Knife::Core, as it's going to be faster than splitting off the metadata generation and time is a concern. If we find that we need the metadata generation in chef/ proper, we should evaluate decoupling that functionality from Knife::CookbookMetadata and exposing it via something like `Chef::Cookbook::Metadata#from_cookbook_files` == spec changes == The specs are kept in their existing locations, though we have separated out a `knife_spec_helper` so that we can ensure knife is not directly accessing chef requires; and chef is relying on knife's at all. We also now clear gem paths with each test, to force gem state to reset. This works around a problem where a combination of tests is corrupting the internal Gem state, causing failures in rubygems_spec. See branch `mp/broken-gems` for many more details around findings so far. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec/unit/knife')
-rw-r--r--spec/unit/knife/bootstrap/chef_vault_handler_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/client_builder_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap/train_connector_spec.rb2
-rw-r--r--spec/unit/knife/bootstrap_spec.rb4
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_create_spec.rb2
-rw-r--r--spec/unit/knife/client_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_edit_spec.rb2
-rw-r--r--spec/unit/knife/client_list_spec.rb2
-rw-r--r--spec/unit/knife/client_reregister_spec.rb2
-rw-r--r--spec/unit/knife/client_show_spec.rb2
-rw-r--r--spec/unit/knife/configure_client_spec.rb2
-rw-r--r--spec/unit/knife/configure_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_list_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_metadata_from_file_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_metadata_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb2
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb2
-rw-r--r--spec/unit/knife/core/cookbook_scm_repo_spec.rb2
-rw-r--r--spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb198
-rw-r--r--spec/unit/knife/core/gem_glob_loader_spec.rb39
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb2
-rw-r--r--spec/unit/knife/core/object_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/status_presenter_spec.rb2
-rw-r--r--spec/unit/knife/core/subcommand_loader_spec.rb2
-rw-r--r--spec/unit/knife/core/ui_spec.rb2
-rw-r--r--spec/unit/knife/core/windows_bootstrap_context_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_create_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_edit_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_secret_options_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb2
-rw-r--r--spec/unit/knife/environment_compare_spec.rb2
-rw-r--r--spec/unit/knife/environment_create_spec.rb2
-rw-r--r--spec/unit/knife/environment_delete_spec.rb2
-rw-r--r--spec/unit/knife/environment_edit_spec.rb2
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb2
-rw-r--r--spec/unit/knife/environment_list_spec.rb2
-rw-r--r--spec/unit/knife/environment_show_spec.rb2
-rw-r--r--spec/unit/knife/key_create_spec.rb2
-rw-r--r--spec/unit/knife/key_delete_spec.rb2
-rw-r--r--spec/unit/knife/key_edit_spec.rb2
-rw-r--r--spec/unit/knife/key_helper.rb2
-rw-r--r--spec/unit/knife/key_list_spec.rb2
-rw-r--r--spec/unit/knife/key_show_spec.rb2
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_edit_spec.rb2
-rw-r--r--spec/unit/knife/node_environment_set_spec.rb2
-rw-r--r--spec/unit/knife/node_from_file_spec.rb2
-rw-r--r--spec/unit/knife/node_list_spec.rb2
-rw-r--r--spec/unit/knife/node_policy_set_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/node_show_spec.rb2
-rw-r--r--spec/unit/knife/org_create_spec.rb2
-rw-r--r--spec/unit/knife/org_delete_spec.rb2
-rw-r--r--spec/unit/knife/org_edit_spec.rb2
-rw-r--r--spec/unit/knife/org_list_spec.rb2
-rw-r--r--spec/unit/knife/org_show_spec.rb2
-rw-r--r--spec/unit/knife/org_user_add_spec.rb2
-rw-r--r--spec/unit/knife/raw_spec.rb2
-rw-r--r--spec/unit/knife/role_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_create_spec.rb2
-rw-r--r--spec/unit/knife/role_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_edit_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_from_file_spec.rb2
-rw-r--r--spec/unit/knife/role_list_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_show_spec.rb2
-rw-r--r--spec/unit/knife/ssh_spec.rb2
-rw-r--r--spec/unit/knife/ssl_check_spec.rb2
-rw-r--r--spec/unit/knife/ssl_fetch_spec.rb2
-rw-r--r--spec/unit/knife/status_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_download_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_install_spec.rb3
-rw-r--r--spec/unit/knife/supermarket_list_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_search_spec.rb2
-rw-r--r--spec/unit/knife/supermarket_share_spec.rb12
-rw-r--r--spec/unit/knife/supermarket_unshare_spec.rb2
-rw-r--r--spec/unit/knife/tag_create_spec.rb2
-rw-r--r--spec/unit/knife/tag_delete_spec.rb2
-rw-r--r--spec/unit/knife/tag_list_spec.rb2
-rw-r--r--spec/unit/knife/user_create_spec.rb2
-rw-r--r--spec/unit/knife/user_delete_spec.rb2
-rw-r--r--spec/unit/knife/user_edit_spec.rb2
-rw-r--r--spec/unit/knife/user_list_spec.rb2
-rw-r--r--spec/unit/knife/user_password_spec.rb2
-rw-r--r--spec/unit/knife/user_reregister_spec.rb2
-rw-r--r--spec/unit/knife/user_show_spec.rb2
105 files changed, 344 insertions, 112 deletions
diff --git a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
index 4d36208be0..a4d007611e 100644
--- a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
+++ b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Bootstrap::ChefVaultHandler do
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb
index 10edd13882..cf6999b093 100644
--- a/spec/unit/knife/bootstrap/client_builder_spec.rb
+++ b/spec/unit/knife/bootstrap/client_builder_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Bootstrap::ClientBuilder do
diff --git a/spec/unit/knife/bootstrap/train_connector_spec.rb b/spec/unit/knife/bootstrap/train_connector_spec.rb
index 4c384100fa..0a1091fa8d 100644
--- a/spec/unit/knife/bootstrap/train_connector_spec.rb
+++ b/spec/unit/knife/bootstrap/train_connector_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "ostruct"
require "chef/knife/bootstrap/train_connector"
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index a3dd714094..f2f2f48f98 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::Bootstrap.load_deps
@@ -185,7 +185,7 @@ describe Chef::Knife::Bootstrap do
context "when :bootstrap_template config is set to a template name" do
let(:bootstrap_template) { "example" }
- let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../lib/chef/knife/bootstrap/templates", "example.erb")) }
+ let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../knife/lib/chef/knife/bootstrap/templates", "example.erb")) }
let(:chef_config_dir_template_path) { "/knife/chef/config/bootstrap/example.erb" }
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 435eb888aa..86d69ff4d6 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientBulkDelete do
let(:stdout_io) { StringIO.new }
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb
index d8b67de101..48a7e71df5 100644
--- a/spec/unit/knife/client_create_spec.rb
+++ b/spec/unit/knife/client_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::ClientCreate.load_deps
diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb
index 41a83b05e4..ec20878ade 100644
--- a/spec/unit/knife/client_delete_spec.rb
+++ b/spec/unit/knife/client_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientDelete do
before(:each) do
diff --git a/spec/unit/knife/client_edit_spec.rb b/spec/unit/knife/client_edit_spec.rb
index e7c9030883..03ac450b3e 100644
--- a/spec/unit/knife/client_edit_spec.rb
+++ b/spec/unit/knife/client_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/api_client_v1"
describe Chef::Knife::ClientEdit do
diff --git a/spec/unit/knife/client_list_spec.rb b/spec/unit/knife/client_list_spec.rb
index d1b379a787..b6a205e6b1 100644
--- a/spec/unit/knife/client_list_spec.rb
+++ b/spec/unit/knife/client_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientList do
before(:each) do
diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb
index 6b6519d44f..f1217edee4 100644
--- a/spec/unit/knife/client_reregister_spec.rb
+++ b/spec/unit/knife/client_reregister_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientReregister do
before(:each) do
diff --git a/spec/unit/knife/client_show_spec.rb b/spec/unit/knife/client_show_spec.rb
index 47b4b6ccb0..39928a6289 100644
--- a/spec/unit/knife/client_show_spec.rb
+++ b/spec/unit/knife/client_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ClientShow do
before(:each) do
diff --git a/spec/unit/knife/configure_client_spec.rb b/spec/unit/knife/configure_client_spec.rb
index b104718c89..f88ffb31ed 100644
--- a/spec/unit/knife/configure_client_spec.rb
+++ b/spec/unit/knife/configure_client_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::ConfigureClient do
before do
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb
index 7d6c840d1f..f9d1bea8fd 100644
--- a/spec/unit/knife/configure_spec.rb
+++ b/spec/unit/knife/configure_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Configure do
before do
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index 3527d39bd8..52f9c1eeb9 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/cookbook_delete_spec.rb b/spec/unit/knife/cookbook_delete_spec.rb
index f2aa7e1be0..b05006f2d3 100644
--- a/spec/unit/knife/cookbook_delete_spec.rb
+++ b/spec/unit/knife/cookbook_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookDelete do
before(:each) do
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index c8903dea5b..b3dbc81205 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookDownload do
before(:each) do
diff --git a/spec/unit/knife/cookbook_list_spec.rb b/spec/unit/knife/cookbook_list_spec.rb
index 4cf806c6f0..42c3ef1bfd 100644
--- a/spec/unit/knife/cookbook_list_spec.rb
+++ b/spec/unit/knife/cookbook_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookList do
before do
diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
index f9bbffae2d..c595aef96f 100644
--- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookMetadataFromFile do
before(:each) do
diff --git a/spec/unit/knife/cookbook_metadata_spec.rb b/spec/unit/knife/cookbook_metadata_spec.rb
index 732cf78421..1a274cc6f4 100644
--- a/spec/unit/knife/cookbook_metadata_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookMetadata do
let(:knife) do
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index defc243de3..94e080cb15 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::CookbookShow do
before do
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index dbed8b8a67..0893f6a6b3 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/cookbook_uploader"
require "timeout"
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index a55047a739..79fddc8184 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/bootstrap_context"
describe Chef::Knife::Core::BootstrapContext do
diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
index 316cbdfaa6..68a155bbbe 100644
--- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb
+++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/cookbook_scm_repo"
describe Chef::Knife::CookbookSCMRepo do
diff --git a/spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb b/spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb
new file mode 100644
index 0000000000..f40626990a
--- /dev/null
+++ b/spec/unit/knife/core/cookbook_site_streaming_uploader_spec.rb
@@ -0,0 +1,198 @@
+#
+# Author:: Xabier de Zuazo (xabier@onddo.com)
+# Copyright:: Copyright 2013-2016, Onddo Labs, SL.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "knife_spec_helper"
+
+require "chef/knife/core/cookbook_site_streaming_uploader"
+
+class FakeTempfile
+ def initialize(basename)
+ @basename = basename
+ end
+
+ def close; end
+
+ def path
+ "#{@basename}.ZZZ"
+ end
+
+end
+
+describe Chef::Knife::Core::CookbookSiteStreamingUploader do
+
+ let(:subject) { Chef::Knife::Core::CookbookSiteStreamingUploader }
+ describe "create_build_dir" do
+ before(:each) do
+ @cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
+ @loader = Chef::CookbookLoader.new(@cookbook_repo)
+ @loader.load_cookbooks
+ allow(File).to receive(:unlink)
+ end
+
+ it "should create the cookbook tmp dir" do
+ cookbook = @loader[:openldap]
+ files_count = Dir.glob(File.join(@cookbook_repo, cookbook.name.to_s, "**", "*"), File::FNM_DOTMATCH).count { |file| File.file?(file) }
+
+ expect(Tempfile).to receive(:new).with("chef-#{cookbook.name}-build").and_return(FakeTempfile.new("chef-#{cookbook.name}-build"))
+ expect(FileUtils).to receive(:mkdir_p).exactly(files_count + 1).times
+ expect(FileUtils).to receive(:cp).exactly(files_count).times
+ subject.create_build_dir(cookbook)
+ end
+
+ end # create_build_dir
+
+ describe "make_request" do
+
+ before(:each) do
+ @uri = "http://cookbooks.dummy.com/api/v1/cookbooks"
+ @secret_filename = File.join(CHEF_SPEC_DATA, "ssl/private_key.pem")
+ @rsa_key = File.read(@secret_filename)
+ response = Net::HTTPResponse.new("1.0", "200", "OK")
+ allow_any_instance_of(Net::HTTP).to receive(:request).and_return(response)
+ end
+
+ it "should send an http request" do
+ expect_any_instance_of(Net::HTTP).to receive(:request)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
+ end
+
+ it "should read the private key file" do
+ expect(File).to receive(:read).with(@secret_filename).and_return(@rsa_key)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
+ end
+
+ it "should add the authentication signed header" do
+ expect_any_instance_of(Mixlib::Authentication::SigningObject).to receive(:sign).and_return({})
+ subject.make_request(:post, @uri, "bill", @secret_filename)
+ end
+
+ it "should be able to send post requests" do
+ post = Net::HTTP::Post.new(@uri, {})
+
+ expect(Net::HTTP::Post).to receive(:new).once.and_return(post)
+ expect(Net::HTTP::Put).not_to receive(:new)
+ expect(Net::HTTP::Get).not_to receive(:new)
+ subject.make_request(:post, @uri, "bill", @secret_filename)
+ end
+
+ it "should be able to send put requests" do
+ put = Net::HTTP::Put.new(@uri, {})
+
+ expect(Net::HTTP::Post).not_to receive(:new)
+ expect(Net::HTTP::Put).to receive(:new).once.and_return(put)
+ expect(Net::HTTP::Get).not_to receive(:new)
+ subject.make_request(:put, @uri, "bill", @secret_filename)
+ end
+
+ it "should be able to receive files to attach as argument" do
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
+ myfile: File.new(File.join(CHEF_SPEC_DATA, "config.rb")), # a dummy file
+ })
+ end
+
+ it "should be able to receive strings to attach as argument" do
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
+ mystring: "Lorem ipsum",
+ })
+ end
+
+ it "should be able to receive strings and files as argument at the same time" do
+ subject.make_request(:put, @uri, "bill", @secret_filename, {
+ myfile1: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
+ mystring1: "Lorem ipsum",
+ myfile2: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
+ mystring2: "Dummy text",
+ })
+ end
+
+ end # make_request
+
+ describe "StreamPart" do
+ before(:each) do
+ @file = File.new(File.join(CHEF_SPEC_DATA, "config.rb"))
+ @stream_part = Chef::Knife::Core::CookbookSiteStreamingUploader::StreamPart.new(@file, File.size(@file))
+ end
+
+ it "should create a StreamPart" do
+ expect(@stream_part).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::StreamPart)
+ end
+
+ it "should expose its size" do
+ expect(@stream_part.size).to eql(File.size(@file))
+ end
+
+ it "should read with offset and how_much" do
+ content = @file.read(4)
+ @file.rewind
+ expect(@stream_part.read(0, 4)).to eql(content)
+ end
+
+ end # StreamPart
+
+ describe "StringPart" do
+ before(:each) do
+ @str = "What a boring string"
+ @string_part = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@str)
+ end
+
+ it "should create a StringPart" do
+ expect(@string_part).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart)
+ end
+
+ it "should expose its size" do
+ expect(@string_part.size).to eql(@str.size)
+ end
+
+ it "should read with offset and how_much" do
+ expect(@string_part.read(2, 4)).to eql(@str[2, 4])
+ end
+
+ end # StringPart
+
+ describe "MultipartStream" do
+ before(:each) do
+ @string1 = "stream1"
+ @string2 = "stream2"
+ @stream1 = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@string1)
+ @stream2 = Chef::Knife::Core::CookbookSiteStreamingUploader::StringPart.new(@string2)
+ @parts = [ @stream1, @stream2 ]
+
+ @multipart_stream = Chef::Knife::Core::CookbookSiteStreamingUploader::MultipartStream.new(@parts)
+ end
+
+ it "should create a MultipartStream" do
+ expect(@multipart_stream).to be_instance_of(Chef::Knife::Core::CookbookSiteStreamingUploader::MultipartStream)
+ end
+
+ it "should expose its size" do
+ expect(@multipart_stream.size).to eql(@stream1.size + @stream2.size)
+ end
+
+ it "should read with how_much" do
+ expect(@multipart_stream.read(10)).to eql("#{@string1}#{@string2}"[0, 10])
+ end
+
+ it "should read receiving destination buffer as second argument (CHEF-4456: Ruby 2 compat)" do
+ dst_buf = ""
+ @multipart_stream.read(10, dst_buf)
+ expect(dst_buf).to eql("#{@string1}#{@string2}"[0, 10])
+ end
+
+ end # MultipartStream
+
+end
diff --git a/spec/unit/knife/core/gem_glob_loader_spec.rb b/spec/unit/knife/core/gem_glob_loader_spec.rb
index f0c29b86a0..a6a94cc57a 100644
--- a/spec/unit/knife/core/gem_glob_loader_spec.rb
+++ b/spec/unit/knife/core/gem_glob_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader::GemGlobLoader do
let(:loader) { Chef::Knife::SubcommandLoader::GemGlobLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
@@ -24,11 +24,11 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
before do
allow(ChefUtils).to receive(:windows?) { false }
- Chef::Util::PathHelper.class_variable_set(:@@home_dir, home)
+ ChefConfig::PathHelper.class_variable_set(:@@home_dir, home)
end
after do
- Chef::Util::PathHelper.class_variable_set(:@@home_dir, nil)
+ ChefConfig::PathHelper.class_variable_set(:@@home_dir, nil)
end
it "builds a list of the core subcommand file require paths" do
@@ -62,12 +62,42 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
expect(loader.subcommand_files.select { |file| file.include?("knife-ec2") }.sort).to eq(gem_files)
end
+ it "excludes knife version file if loaded from a gem" do
+ gems = [ double("knife-ec2-0.5.12") ]
+ gem_files = [
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/version.rb",
+ ]
+ expected_files = [
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb"
+ ]
+
+ expect($LOAD_PATH).to receive(:map).and_return([])
+ if Gem::Specification.respond_to? :latest_specs
+ expect(Gem::Specification).to receive(:latest_specs).with(true).and_return(gems)
+ expect(gems[0]).to receive(:matches_for_glob).with(%r{chef/knife/\*\.rb\{(.*),\.rb,(.*)\}}).and_return(gem_files)
+ else
+ expect(Gem.source_index).to receive(:latest_specs).with(true).and_return(gems)
+ expect(gems[0]).to receive(:require_paths).twice.and_return(["lib"])
+ expect(gems[0]).to receive(:full_gem_path).and_return("/usr/lib/ruby/gems/knife-ec2-0.5.12")
+ expect(Dir).to receive(:[]).with("/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/*.rb").and_return(gem_files)
+ end
+ expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
+ expect(loader.subcommand_files.select { |file| file.include?("knife-ec2") }.sort).to eq(expected_files)
+ end
it "finds files using a dirglob when rubygems is not available" do
expect(loader.find_subcommands_via_dirglob).to include("chef/knife/node_create")
loader.find_subcommands_via_dirglob.each_value { |abs_path| expect(abs_path).to match(%r{chef/knife/.+}) }
end
+ it "excludes chef/knife/version.rb using a dirglob when rubygems is not available" do
+ expect(loader.find_subcommands_via_dirglob).to_not include("chef/knife/version")
+ loader.find_subcommands_via_dirglob.each_value { |abs_path| expect(abs_path).to match(%r{chef/knife/.+}) }
+ end
+
it "finds user-specific subcommands in the user's ~/.chef directory" do
expected_command = File.join(home, ".chef", "plugins", "knife", "example_home_subcommand.rb")
expect(loader.site_subcommands).to include(expected_command)
@@ -86,6 +116,9 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
# source tree of the "primary" chef install, it can be loaded and cause an
# error. We also want to ensure that we only load builtin commands from the
# "primary" chef install.
+ #
+ # NOTE - we need to revisit coverage now that we're moving knife to its own gem;
+ # or remove this test if it's no longer a supported scenario.
context "when a different version of chef is also installed as a gem" do
let(:all_found_commands) do
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index c88656945b..305c928309 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
before do
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index d8e5c86d2c..f4fbe76695 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/node_editor"
describe Chef::Knife::NodeEditor do
diff --git a/spec/unit/knife/core/object_loader_spec.rb b/spec/unit/knife/core/object_loader_spec.rb
index 0dcabff46d..00a9ed4553 100644
--- a/spec/unit/knife/core/object_loader_spec.rb
+++ b/spec/unit/knife/core/object_loader_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/object_loader"
describe Chef::Knife::Core::ObjectLoader do
diff --git a/spec/unit/knife/core/status_presenter_spec.rb b/spec/unit/knife/core/status_presenter_spec.rb
index 377c581bfc..a3f297045b 100644
--- a/spec/unit/knife/core/status_presenter_spec.rb
+++ b/spec/unit/knife/core/status_presenter_spec.rb
@@ -14,7 +14,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Core::StatusPresenter do
describe "#summarize_json" do
diff --git a/spec/unit/knife/core/subcommand_loader_spec.rb b/spec/unit/knife/core/subcommand_loader_spec.rb
index e8bc045946..ad53a422fe 100644
--- a/spec/unit/knife/core/subcommand_loader_spec.rb
+++ b/spec/unit/knife/core/subcommand_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SubcommandLoader do
let(:loader) { Chef::Knife::SubcommandLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 3bbe799267..d5d09c0fdf 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -19,7 +19,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UI do
before do
diff --git a/spec/unit/knife/core/windows_bootstrap_context_spec.rb b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
index 76b90c955e..1243dd1559 100644
--- a/spec/unit/knife/core/windows_bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/windows_bootstrap_context_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/core/windows_bootstrap_context"
describe Chef::Knife::Core::WindowsBootstrapContext do
let(:config) { {} }
diff --git a/spec/unit/knife/data_bag_create_spec.rb b/spec/unit/knife/data_bag_create_spec.rb
index 93082c190e..6700d886fc 100644
--- a/spec/unit/knife/data_bag_create_spec.rb
+++ b/spec/unit/knife/data_bag_create_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tempfile"
describe Chef::Knife::DataBagCreate do
diff --git a/spec/unit/knife/data_bag_edit_spec.rb b/spec/unit/knife/data_bag_edit_spec.rb
index 6ebcaf4945..1be75ba014 100644
--- a/spec/unit/knife/data_bag_edit_spec.rb
+++ b/spec/unit/knife/data_bag_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "tempfile"
describe Chef::Knife::DataBagEdit do
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index 12211eede3..4d7c506d0d 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/data_bag_item"
require "chef/encrypted_data_bag_item"
diff --git a/spec/unit/knife/data_bag_secret_options_spec.rb b/spec/unit/knife/data_bag_secret_options_spec.rb
index e8f99c3f79..9946b82110 100644
--- a/spec/unit/knife/data_bag_secret_options_spec.rb
+++ b/spec/unit/knife/data_bag_secret_options_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife"
require "chef/config"
require "tempfile"
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index 2b806b8a65..0cc0bdf766 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/data_bag_item"
require "chef/encrypted_data_bag_item"
diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb
index bfaeed0c82..001c725624 100644
--- a/spec/unit/knife/environment_compare_spec.rb
+++ b/spec/unit/knife/environment_compare_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentCompare do
before(:each) do
diff --git a/spec/unit/knife/environment_create_spec.rb b/spec/unit/knife/environment_create_spec.rb
index d54cab8dc9..0535276e9c 100644
--- a/spec/unit/knife/environment_create_spec.rb
+++ b/spec/unit/knife/environment_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentCreate do
before(:each) do
diff --git a/spec/unit/knife/environment_delete_spec.rb b/spec/unit/knife/environment_delete_spec.rb
index 643bf1cc13..e088f6a791 100644
--- a/spec/unit/knife/environment_delete_spec.rb
+++ b/spec/unit/knife/environment_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentDelete do
before(:each) do
diff --git a/spec/unit/knife/environment_edit_spec.rb b/spec/unit/knife/environment_edit_spec.rb
index 1feb1c05fd..f05de2cb2f 100644
--- a/spec/unit/knife/environment_edit_spec.rb
+++ b/spec/unit/knife/environment_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentEdit do
before(:each) do
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index 2090ec7bbd..fb9329eb57 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::EnvironmentFromFile.load_deps
diff --git a/spec/unit/knife/environment_list_spec.rb b/spec/unit/knife/environment_list_spec.rb
index 7bb0e723aa..4f44a93f60 100644
--- a/spec/unit/knife/environment_list_spec.rb
+++ b/spec/unit/knife/environment_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentList do
before(:each) do
diff --git a/spec/unit/knife/environment_show_spec.rb b/spec/unit/knife/environment_show_spec.rb
index 8f67e593bc..536afcc058 100644
--- a/spec/unit/knife/environment_show_spec.rb
+++ b/spec/unit/knife/environment_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::EnvironmentShow do
before(:each) do
diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb
index 12826ae7e2..91d3fc0f69 100644
--- a/spec/unit/knife/key_create_spec.rb
+++ b/spec/unit/knife/key_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_create"
require "chef/knife/client_key_create"
require "chef/knife/key_create"
diff --git a/spec/unit/knife/key_delete_spec.rb b/spec/unit/knife/key_delete_spec.rb
index fd39c7381a..ff669446bb 100644
--- a/spec/unit/knife/key_delete_spec.rb
+++ b/spec/unit/knife/key_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_delete"
require "chef/knife/client_key_delete"
require "chef/knife/key_delete"
diff --git a/spec/unit/knife/key_edit_spec.rb b/spec/unit/knife/key_edit_spec.rb
index b42503af59..ae58d281b7 100644
--- a/spec/unit/knife/key_edit_spec.rb
+++ b/spec/unit/knife/key_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_edit"
require "chef/knife/client_key_edit"
require "chef/knife/key_edit"
diff --git a/spec/unit/knife/key_helper.rb b/spec/unit/knife/key_helper.rb
index 6dbfb567f4..c58d383703 100644
--- a/spec/unit/knife/key_helper.rb
+++ b/spec/unit/knife/key_helper.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
shared_examples_for "a knife key command" do
let(:stderr) { StringIO.new }
diff --git a/spec/unit/knife/key_list_spec.rb b/spec/unit/knife/key_list_spec.rb
index 51ed73b64f..3cb8a1c58d 100644
--- a/spec/unit/knife/key_list_spec.rb
+++ b/spec/unit/knife/key_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_list"
require "chef/knife/client_key_list"
require "chef/knife/key_list"
diff --git a/spec/unit/knife/key_show_spec.rb b/spec/unit/knife/key_show_spec.rb
index 6d1ca2ccc7..ace6dad990 100644
--- a/spec/unit/knife/key_show_spec.rb
+++ b/spec/unit/knife/key_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/user_key_show"
require "chef/knife/client_key_show"
require "chef/knife/key_show"
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index e23f286999..cf38d542fa 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb
index e6c677c041..92932c0b6f 100644
--- a/spec/unit/knife/node_delete_spec.rb
+++ b/spec/unit/knife/node_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeDelete do
before(:each) do
diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb
index 7b2ebb5b2c..e89322d415 100644
--- a/spec/unit/knife/node_edit_spec.rb
+++ b/spec/unit/knife/node_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::NodeEdit.load_deps
describe Chef::Knife::NodeEdit do
diff --git a/spec/unit/knife/node_environment_set_spec.rb b/spec/unit/knife/node_environment_set_spec.rb
index 6a6d48cc2f..c2d55d0ab1 100644
--- a/spec/unit/knife/node_environment_set_spec.rb
+++ b/spec/unit/knife/node_environment_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeEnvironmentSet do
before(:each) do
diff --git a/spec/unit/knife/node_from_file_spec.rb b/spec/unit/knife/node_from_file_spec.rb
index 00d6dd5d1a..359b9726b6 100644
--- a/spec/unit/knife/node_from_file_spec.rb
+++ b/spec/unit/knife/node_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::NodeFromFile.load_deps
diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb
index d594fffc14..baa79cb81f 100644
--- a/spec/unit/knife/node_list_spec.rb
+++ b/spec/unit/knife/node_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeList do
before(:each) do
diff --git a/spec/unit/knife/node_policy_set_spec.rb b/spec/unit/knife/node_policy_set_spec.rb
index 40b1d2617d..5815da29df 100644
--- a/spec/unit/knife/node_policy_set_spec.rb
+++ b/spec/unit/knife/node_policy_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodePolicySet do
let(:node) do
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index 0148711fac..87b75d9818 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index 1974821728..0eff7c6d27 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/node_run_list_set_spec.rb b/spec/unit/knife/node_run_list_set_spec.rb
index 6246dfce6a..35fdd63e4d 100644
--- a/spec/unit/knife/node_run_list_set_spec.rb
+++ b/spec/unit/knife/node_run_list_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeRunListSet do
before(:each) do
diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb
index 037672501e..c26ae94f40 100644
--- a/spec/unit/knife/node_show_spec.rb
+++ b/spec/unit/knife/node_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::NodeShow do
diff --git a/spec/unit/knife/org_create_spec.rb b/spec/unit/knife/org_create_spec.rb
index 3c33817b55..f45ade2df7 100644
--- a/spec/unit/knife/org_create_spec.rb
+++ b/spec/unit/knife/org_create_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgCreate do
diff --git a/spec/unit/knife/org_delete_spec.rb b/spec/unit/knife/org_delete_spec.rb
index baa102f8c8..33311bd678 100644
--- a/spec/unit/knife/org_delete_spec.rb
+++ b/spec/unit/knife/org_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgDelete do
diff --git a/spec/unit/knife/org_edit_spec.rb b/spec/unit/knife/org_edit_spec.rb
index 05339e8f21..af9dae2c49 100644
--- a/spec/unit/knife/org_edit_spec.rb
+++ b/spec/unit/knife/org_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::OrgEdit do
let(:knife) { Chef::Knife::OrgEdit.new }
diff --git a/spec/unit/knife/org_list_spec.rb b/spec/unit/knife/org_list_spec.rb
index de77b4b0c7..aa5fca5099 100644
--- a/spec/unit/knife/org_list_spec.rb
+++ b/spec/unit/knife/org_list_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgList do
diff --git a/spec/unit/knife/org_show_spec.rb b/spec/unit/knife/org_show_spec.rb
index 2f5246dd84..364b879a7c 100644
--- a/spec/unit/knife/org_show_spec.rb
+++ b/spec/unit/knife/org_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgShow do
diff --git a/spec/unit/knife/org_user_add_spec.rb b/spec/unit/knife/org_user_add_spec.rb
index 20e28d6919..72ee1d0607 100644
--- a/spec/unit/knife/org_user_add_spec.rb
+++ b/spec/unit/knife/org_user_add_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
describe Chef::Knife::OrgUserAdd do
diff --git a/spec/unit/knife/raw_spec.rb b/spec/unit/knife/raw_spec.rb
index 1f88195e65..90a09a31e6 100644
--- a/spec/unit/knife/raw_spec.rb
+++ b/spec/unit/knife/raw_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Raw do
let(:rest) do
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index 5af7c51584..f68efba57c 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb
index 0d563e40dd..13f47492b1 100644
--- a/spec/unit/knife/role_create_spec.rb
+++ b/spec/unit/knife/role_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleCreate do
before(:each) do
diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb
index d43f99689d..658da5299d 100644
--- a/spec/unit/knife/role_delete_spec.rb
+++ b/spec/unit/knife/role_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleDelete do
before(:each) do
diff --git a/spec/unit/knife/role_edit_spec.rb b/spec/unit/knife/role_edit_spec.rb
index faf9cf7d84..adade177a7 100644
--- a/spec/unit/knife/role_edit_spec.rb
+++ b/spec/unit/knife/role_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEdit do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_add_spec.rb b/spec/unit/knife/role_env_run_list_add_spec.rb
index 13a05db33e..b42ec6141f 100644
--- a/spec/unit/knife/role_env_run_list_add_spec.rb
+++ b/spec/unit/knife/role_env_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_clear_spec.rb b/spec/unit/knife/role_env_run_list_clear_spec.rb
index d4b9625550..ad88d1ae37 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListClear do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_remove_spec.rb b/spec/unit/knife/role_env_run_list_remove_spec.rb
index 7f9b41475c..8755ce452b 100644
--- a/spec/unit/knife/role_env_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_env_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_replace_spec.rb b/spec/unit/knife/role_env_run_list_replace_spec.rb
index 93b233efdc..457f4efbd7 100644
--- a/spec/unit/knife/role_env_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_env_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListReplace do
before(:each) do
diff --git a/spec/unit/knife/role_env_run_list_set_spec.rb b/spec/unit/knife/role_env_run_list_set_spec.rb
index d35e4dbb17..34233398f5 100644
--- a/spec/unit/knife/role_env_run_list_set_spec.rb
+++ b/spec/unit/knife/role_env_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleEnvRunListSet do
before(:each) do
diff --git a/spec/unit/knife/role_from_file_spec.rb b/spec/unit/knife/role_from_file_spec.rb
index 51e94d31e3..6e2fdf7cfb 100644
--- a/spec/unit/knife/role_from_file_spec.rb
+++ b/spec/unit/knife/role_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::RoleFromFile.load_deps
diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb
index dea2e874a4..f37a85b6dc 100644
--- a/spec/unit/knife/role_list_spec.rb
+++ b/spec/unit/knife/role_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleList do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_add_spec.rb b/spec/unit/knife/role_run_list_add_spec.rb
index 6f222ee80a..7b038c2e81 100644
--- a/spec/unit/knife/role_run_list_add_spec.rb
+++ b/spec/unit/knife/role_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_clear_spec.rb b/spec/unit/knife/role_run_list_clear_spec.rb
index 327a9979b0..5479b01811 100644
--- a/spec/unit/knife/role_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListClear do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_remove_spec.rb b/spec/unit/knife/role_run_list_remove_spec.rb
index 200a559c08..353ae36c1a 100644
--- a/spec/unit/knife/role_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListRemove do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_replace_spec.rb b/spec/unit/knife/role_run_list_replace_spec.rb
index 1957403fb1..e59b704f00 100644
--- a/spec/unit/knife/role_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListReplace do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_set_spec.rb b/spec/unit/knife/role_run_list_set_spec.rb
index 06098c585e..b75f1ab377 100644
--- a/spec/unit/knife/role_run_list_set_spec.rb
+++ b/spec/unit/knife/role_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleRunListSet do
before(:each) do
diff --git a/spec/unit/knife/role_show_spec.rb b/spec/unit/knife/role_show_spec.rb
index fe48e2f940..a79cb40e81 100644
--- a/spec/unit/knife/role_show_spec.rb
+++ b/spec/unit/knife/role_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::RoleShow do
let(:role) { "base" }
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 8606045e8c..59015f024a 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "net/ssh"
require "net/ssh/multi"
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb
index 1165da4539..4412ee0be9 100644
--- a/spec/unit/knife/ssl_check_spec.rb
+++ b/spec/unit/knife/ssl_check_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "stringio"
describe Chef::Knife::SslCheck do
diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb
index 2184994dc0..c2dc5bdade 100644
--- a/spec/unit/knife/ssl_fetch_spec.rb
+++ b/spec/unit/knife/ssl_fetch_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/ssl_fetch"
describe Chef::Knife::SslFetch do
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index 838e4c9600..f3b31c1897 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::Status do
before(:each) do
diff --git a/spec/unit/knife/supermarket_download_spec.rb b/spec/unit/knife/supermarket_download_spec.rb
index 5d15e74966..3796140d61 100644
--- a/spec/unit/knife/supermarket_download_spec.rb
+++ b/spec/unit/knife/supermarket_download_spec.rb
@@ -18,7 +18,7 @@
#
require "chef/knife/supermarket_download"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketDownload do
diff --git a/spec/unit/knife/supermarket_install_spec.rb b/spec/unit/knife/supermarket_install_spec.rb
index 03cc5d1992..6ebbbc005c 100644
--- a/spec/unit/knife/supermarket_install_spec.rb
+++ b/spec/unit/knife/supermarket_install_spec.rb
@@ -16,8 +16,9 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_install"
+require "mixlib/archive"
describe Chef::Knife::SupermarketInstall do
let(:knife) { Chef::Knife::SupermarketInstall.new }
diff --git a/spec/unit/knife/supermarket_list_spec.rb b/spec/unit/knife/supermarket_list_spec.rb
index a1acccaaaa..bbaf733f44 100644
--- a/spec/unit/knife/supermarket_list_spec.rb
+++ b/spec/unit/knife/supermarket_list_spec.rb
@@ -17,7 +17,7 @@
#
require "chef/knife/supermarket_list"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketList do
let(:knife) { described_class.new }
diff --git a/spec/unit/knife/supermarket_search_spec.rb b/spec/unit/knife/supermarket_search_spec.rb
index cba2f615aa..18092f52c8 100644
--- a/spec/unit/knife/supermarket_search_spec.rb
+++ b/spec/unit/knife/supermarket_search_spec.rb
@@ -17,7 +17,7 @@
#
require "chef/knife/supermarket_search"
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::SupermarketSearch do
let(:knife) { described_class.new }
diff --git a/spec/unit/knife/supermarket_share_spec.rb b/spec/unit/knife/supermarket_share_spec.rb
index 088cef9dfd..d362edf3c0 100644
--- a/spec/unit/knife/supermarket_share_spec.rb
+++ b/spec/unit/knife/supermarket_share_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_share"
require "chef/cookbook_uploader"
-require "chef/cookbook_site_streaming_uploader"
+require "chef/knife/core/cookbook_site_streaming_uploader"
describe Chef::Knife::SupermarketShare do
@@ -42,7 +42,7 @@ describe Chef::Knife::SupermarketShare do
@cookbook_uploader = Chef::CookbookUploader.new("herpderp", rest: "norest")
allow(Chef::CookbookUploader).to receive(:new).and_return(@cookbook_uploader)
allow(@cookbook_uploader).to receive(:validate_cookbooks).and_return(true)
- allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return(Dir.mktmpdir)
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return(Dir.mktmpdir)
allow(@knife).to receive(:shell_out!).and_return(true)
@stdout = StringIO.new
@@ -140,7 +140,7 @@ describe Chef::Knife::SupermarketShare do
context "when the --dry-run flag is specified" do
before do
- allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
@knife.config = { dry_run: true }
@so = instance_double("Mixlib::ShellOut")
allow(@knife).to receive(:shell_out!).and_return(@so)
@@ -165,7 +165,7 @@ describe Chef::Knife::SupermarketShare do
before(:each) do
@upload_response = double("Net::HTTPResponse")
- allow(Chef::CookbookSiteStreamingUploader).to receive(:post).and_return(@upload_response)
+ allow(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:post).and_return(@upload_response)
allow(File).to receive(:open).and_return(true)
end
@@ -174,7 +174,7 @@ describe Chef::Knife::SupermarketShare do
response_text = Chef::JSONCompat.to_json({ uri: "https://supermarket.chef.io/cookbooks/cookbook_name" })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(201)
- expect(Chef::CookbookSiteStreamingUploader).to receive(:post).with(/supermarket\.chef\.io/, anything, anything, anything)
+ expect(Chef::Knife::Core::CookbookSiteStreamingUploader).to receive(:post).with(/supermarket\.chef\.io/, anything, anything, anything)
@knife.run
end
diff --git a/spec/unit/knife/supermarket_unshare_spec.rb b/spec/unit/knife/supermarket_unshare_spec.rb
index 8ae4d03cb5..63682a663c 100644
--- a/spec/unit/knife/supermarket_unshare_spec.rb
+++ b/spec/unit/knife/supermarket_unshare_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/knife/supermarket_unshare"
describe Chef::Knife::SupermarketUnshare do
diff --git a/spec/unit/knife/tag_create_spec.rb b/spec/unit/knife/tag_create_spec.rb
index a1a4923871..290b925f4e 100644
--- a/spec/unit/knife/tag_create_spec.rb
+++ b/spec/unit/knife/tag_create_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagCreate do
before(:each) do
diff --git a/spec/unit/knife/tag_delete_spec.rb b/spec/unit/knife/tag_delete_spec.rb
index 4201196de0..dd01fba50f 100644
--- a/spec/unit/knife/tag_delete_spec.rb
+++ b/spec/unit/knife/tag_delete_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagDelete do
before(:each) do
diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb
index dceec9a5ea..5da7803e09 100644
--- a/spec/unit/knife/tag_list_spec.rb
+++ b/spec/unit/knife/tag_list_spec.rb
@@ -1,4 +1,4 @@
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::TagList do
before(:each) do
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index c69a668f7e..fb6a2c3ba0 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::UserCreate.load_deps
diff --git a/spec/unit/knife/user_delete_spec.rb b/spec/unit/knife/user_delete_spec.rb
index 4dd2665cda..57d4072c50 100644
--- a/spec/unit/knife/user_delete_spec.rb
+++ b/spec/unit/knife/user_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserDelete.load_deps
diff --git a/spec/unit/knife/user_edit_spec.rb b/spec/unit/knife/user_edit_spec.rb
index 2fde328c0c..12e2f19561 100644
--- a/spec/unit/knife/user_edit_spec.rb
+++ b/spec/unit/knife/user_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UserEdit do
let(:knife) { Chef::Knife::UserEdit.new }
diff --git a/spec/unit/knife/user_list_spec.rb b/spec/unit/knife/user_list_spec.rb
index 63df590591..01013de352 100644
--- a/spec/unit/knife/user_list_spec.rb
+++ b/spec/unit/knife/user_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
Chef::Knife::UserList.load_deps
diff --git a/spec/unit/knife/user_password_spec.rb b/spec/unit/knife/user_password_spec.rb
index 098597a14c..139ed242de 100644
--- a/spec/unit/knife/user_password_spec.rb
+++ b/spec/unit/knife/user_password_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserDelete.load_deps
diff --git a/spec/unit/knife/user_reregister_spec.rb b/spec/unit/knife/user_reregister_spec.rb
index 481415e432..9178996abf 100644
--- a/spec/unit/knife/user_reregister_spec.rb
+++ b/spec/unit/knife/user_reregister_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
describe Chef::Knife::UserReregister do
let(:knife) { Chef::Knife::UserReregister.new }
diff --git a/spec/unit/knife/user_show_spec.rb b/spec/unit/knife/user_show_spec.rb
index 30742d8c21..3bcbbcb648 100644
--- a/spec/unit/knife/user_show_spec.rb
+++ b/spec/unit/knife/user_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require "spec_helper"
+require "knife_spec_helper"
require "chef/org"
Chef::Knife::UserShow.load_deps