diff options
author | Neha Pansare <neha.pansare@progress.com> | 2022-02-14 20:07:30 +0530 |
---|---|---|
committer | Neha Pansare <neha.pansare@progress.com> | 2022-02-15 17:09:44 +0530 |
commit | 5b26f94d92700ddffe12b93f0833d3c8fc664393 (patch) | |
tree | a44d63175decc8d9bac0bfcbe0cded43fde1a44e /chef-config/spec | |
parent | 982f6d3ce55158bac1de14bb752c84efd74de079 (diff) | |
download | chef-5b26f94d92700ddffe12b93f0833d3c8fc664393.tar.gz |
Avoid calculating etc_chef_dir multiple times on startup, add test cases
Signed-off-by: Neha Pansare <neha.pansare@progress.com>
Diffstat (limited to 'chef-config/spec')
-rw-r--r-- | chef-config/spec/unit/config_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb index 658acca615..d4d5844d3d 100644 --- a/chef-config/spec/unit/config_spec.rb +++ b/chef-config/spec/unit/config_spec.rb @@ -282,6 +282,14 @@ RSpec.describe ChefConfig::Config do expect(ChefConfig::Config.etc_chef_dir(windows: true)).to eql("C:\\#{dirname}") end end + + context "when calling etc_chef_dir multiple times" do + it "should not recalculate path for every call" do + expect(ChefConfig::Config.etc_chef_dir(windows: false)).to eql("/etc/#{dirname}") + expect(ChefConfig::PathHelper).not_to receive(:cleanpath) + expect(ChefConfig::Config.etc_chef_dir(windows: false)).to eql("/etc/#{dirname}") + end + end end [ false, true ].each do |is_windows| |