diff options
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/chef_fs/path_util_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/cookbook_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/dsl/declare_resource_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/file_access_control_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 12 | ||||
-rw-r--r-- | spec/unit/lwrp_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/mixin/securable_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/recipe_spec.rb | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/spec/unit/chef_fs/path_util_spec.rb b/spec/unit/chef_fs/path_util_spec.rb index 694dabf5d7..4056c240cc 100644 --- a/spec/unit/chef_fs/path_util_spec.rb +++ b/spec/unit/chef_fs/path_util_spec.rb @@ -61,7 +61,7 @@ describe Chef::ChefFS::PathUtils do end context "invoking realest_path" do - let(:good_path) { File.dirname(__FILE__) } + let(:good_path) { __dir__ } let(:parent_path) { File.dirname(good_path) } it "handles paths with no wildcards or globs" do diff --git a/spec/unit/cookbook_spec.rb b/spec/unit/cookbook_spec.rb index 85c31ab42b..04b729c127 100644 --- a/spec/unit/cookbook_spec.rb +++ b/spec/unit/cookbook_spec.rb @@ -19,10 +19,10 @@ require "spec_helper" describe Chef::CookbookVersion do - COOKBOOK_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks", "openldap")) + COOKBOOK_PATH = File.expand_path(File.join(__dir__, "..", "data", "cookbooks", "openldap")) before(:each) do - @cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks")) + @cookbook_repo = File.expand_path(File.join(__dir__, "..", "data", "cookbooks")) cl = Chef::CookbookLoader.new(@cookbook_repo) cl.load_cookbooks @cookbook_collection = Chef::CookbookCollection.new(cl) diff --git a/spec/unit/dsl/declare_resource_spec.rb b/spec/unit/dsl/declare_resource_spec.rb index 4fcdd4d048..53b0713c42 100644 --- a/spec/unit/dsl/declare_resource_spec.rb +++ b/spec/unit/dsl/declare_resource_spec.rb @@ -19,7 +19,7 @@ require "spec_helper" describe Chef::ResourceCollection do let(:run_context) do - cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "data", "cookbooks")) + cookbook_repo = File.expand_path(File.join(__dir__, "..", "..", "data", "cookbooks")) cookbook_loader = Chef::CookbookLoader.new(cookbook_repo) cookbook_loader.load_cookbooks node = Chef::Node.new diff --git a/spec/unit/file_access_control_spec.rb b/spec/unit/file_access_control_spec.rb index 18983e6ff5..dfa0bcf673 100644 --- a/spec/unit/file_access_control_spec.rb +++ b/spec/unit/file_access_control_spec.rb @@ -26,7 +26,7 @@ describe Chef::FileAccessControl do # we have to re-load the file so the proper # platform specific module is mixed in @node = Chef::Node.new - load File.join(File.dirname(__FILE__), "..", "..", "lib", "chef", "file_access_control.rb") + load File.join(__dir__, "..", "..", "lib", "chef", "file_access_control.rb") @resource = Chef::Resource::File.new("/tmp/a_file.txt") @resource.owner("toor") @resource.group("wheel") diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index 130a097da2..15a51b7f92 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -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(File.dirname(__FILE__), "../../../lib/chef/knife/bootstrap/templates", "example.erb")) } + let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../lib/chef/knife/bootstrap/templates", "example.erb")) } let(:chef_config_dir_template_path) { "/knife/chef/config/bootstrap/example.erb" } @@ -472,7 +472,7 @@ describe Chef::Knife::Bootstrap do end describe "when transferring trusted certificates" do - let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), "../../data/trusted_certs")) } + let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs")) } let(:rendered_template) do knife.merge_configs @@ -504,7 +504,7 @@ describe Chef::Knife::Bootstrap do end context "when :trusted_cets_dir is empty" do - let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), "../../data/trusted_certs_empty")) } + let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs_empty")) } it "doesn't create /etc/chef/trusted_certs if :trusted_certs_dir is empty" do expect(rendered_template).not_to match(%r{mkdir -p /etc/chef/trusted_certs}) end @@ -514,7 +514,7 @@ describe Chef::Knife::Bootstrap do context "when doing fips things" do let(:template_file) { File.expand_path(File.join(CHEF_SPEC_DATA, "bootstrap", "no_proxy.erb")) } - let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), "../../data/trusted_certs")) } + let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs")) } before do Chef::Config[:knife][:bootstrap_template] = template_file @@ -570,7 +570,7 @@ describe Chef::Knife::Bootstrap do context "when client_d_dir is set" do let(:client_d_dir) do Chef::Util::PathHelper.cleanpath( - File.join(File.dirname(__FILE__), "../../data/client.d_00") + File.join(__dir__, "../../data/client.d_00") ) end @@ -597,7 +597,7 @@ describe Chef::Knife::Bootstrap do context "a nested directory structure" do let(:client_d_dir) do Chef::Util::PathHelper.cleanpath( - File.join(File.dirname(__FILE__), "../../data/client.d_01") + File.join(__dir__, "../../data/client.d_01") ) end it "creates a file foo/bar.rb" do diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index a933d23afe..ac2c95d7e7 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -169,7 +169,7 @@ describe "LWRP" do describe "Lightweight Chef::Resource" do before do - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "resources", "*"))].each do |file| + Dir[File.expand_path(File.join(__dir__, "..", "data", "lwrp", "resources", "*"))].each do |file| Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil) end end @@ -211,7 +211,7 @@ describe "LWRP" do node.normal[:penguin_name] = "jackass" run_context = Chef::RunContext.new(node, Chef::CookbookCollection.new, @events) - Dir[File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "lwrp", "resources_with_default_attributes", "*"))].each do |file| + Dir[File.expand_path(File.join(__dir__, "..", "data", "lwrp", "resources_with_default_attributes", "*"))].each do |file| Chef::Resource::LWRPBase.build_from_file("lwrp", file, run_context) end @@ -654,7 +654,7 @@ describe "LWRP" do end let(:run_context) do - cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks")) + cookbook_repo = File.expand_path(File.join(__dir__, "..", "data", "cookbooks")) cookbook_loader = Chef::CookbookLoader.new(cookbook_repo) cookbook_loader.load_cookbooks cookbook_collection = Chef::CookbookCollection.new(cookbook_loader) diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb index 4863693dba..bbbd6bab84 100644 --- a/spec/unit/mixin/securable_spec.rb +++ b/spec/unit/mixin/securable_spec.rb @@ -45,7 +45,7 @@ describe Chef::Mixin::Securable do describe "unix-specific behavior" do before(:each) do platform_mock :unix do - load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "mixin", "securable.rb") + load File.join(__dir__, "..", "..", "..", "lib", "chef", "mixin", "securable.rb") @securable = Object.new @securable.send(:extend, Chef::Mixin::Securable) @securable.send(:extend, Chef::Mixin::ParamsValidate) @@ -176,7 +176,7 @@ describe Chef::Mixin::Securable do describe "windows-specific behavior" do before(:each) do platform_mock :windows do - load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "mixin", "securable.rb") + load File.join(__dir__, "..", "..", "..", "lib", "chef", "mixin", "securable.rb") securable_class = Class.new do include Chef::Mixin::Securable include Chef::Mixin::ParamsValidate diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 9df46b46e2..ffa7025e3f 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -25,7 +25,7 @@ require "chef/platform/resource_priority_map" describe Chef::Recipe do let(:cookbook_collection) do - cookbook_repo = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks")) + cookbook_repo = File.expand_path(File.join(__dir__, "..", "data", "cookbooks")) cookbook_loader = Chef::CookbookLoader.new(cookbook_repo) cookbook_loader.load_cookbooks Chef::CookbookCollection.new(cookbook_loader) |