From 02be687aedc00cbb9d353fdf237895c01d8e730b Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 15 Apr 2019 11:36:37 -0700 Subject: Fix specs and chefstyle warnings Signed-off-by: Tim Smith --- kitchen-tests/cookbooks/end_to_end/recipes/default.rb | 18 +++++++++--------- spec/unit/resource/archive_file_spec.rb | 9 ++++++++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb index bf132bf6b0..7c9856d909 100644 --- a/kitchen-tests/cookbooks/end_to_end/recipes/default.rb +++ b/kitchen-tests/cookbooks/end_to_end/recipes/default.rb @@ -96,15 +96,15 @@ openssl_rsa_public_key "/etc/ssl/rsakey_aes128cbc.pub" do end # test various archive formats in the archive_file resource -%w(tourism.tar.gz tourism.tar.xz tourism.zip).each do |archive| - cookbook_file File.join(Chef::Config[:file_cache_path], archive) do - source archive - end - - archive_file archive do - path File.join(Chef::Config[:file_cache_path], archive) - extract_to File.join(Chef::Config[:file_cache_path], archive.gsub('.', '_')) - end +%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive| + cookbook_file File.join(Chef::Config[:file_cache_path], archive) do + source archive + end + + archive_file archive do + path File.join(Chef::Config[:file_cache_path], archive) + extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_")) + end end include_recipe "::tests" diff --git a/spec/unit/resource/archive_file_spec.rb b/spec/unit/resource/archive_file_spec.rb index 053c8d614a..d9f40c0d65 100644 --- a/spec/unit/resource/archive_file_spec.rb +++ b/spec/unit/resource/archive_file_spec.rb @@ -26,7 +26,7 @@ describe Chef::Resource::ArchiveFile do end it "has a name property of path" do - expect(resource.path).to eql("foo") + expect(resource.path).to match(/.*foo$/) end it "sets the default action as :extract" do @@ -37,4 +37,11 @@ describe Chef::Resource::ArchiveFile do expect { resource.action :extract }.not_to raise_error end + it "mode property defaults to '755'" do + expect(resource.mode).to eql("755") + end + + it "options property defaults to [:time]" do + expect(resource.options).to eql([:time]) + end end -- cgit v1.2.1