test/unpack_strategy: Handle svn unzip unavailable

Skip those tests that require svn or unzip.
This commit is contained in:
Shaun Jackman 2018-08-13 10:04:32 -07:00
parent 6a581159e6
commit 879f514e28
4 changed files with 11 additions and 4 deletions

View File

@ -85,7 +85,11 @@ RSpec.configure do |config|
end end
config.before(:each, :needs_svn) do config.before(:each, :needs_svn) do
skip "Requires subversion." unless which "svn" skip "subversion not installed." unless which "svn"
end
config.before(:each, :needs_unzip) do
skip "unzip not installed." unless which("unzip")
end end
config.around(:each) do |example| config.around(:each) do |example|

View File

@ -1,6 +1,6 @@
require_relative "shared_examples" require_relative "shared_examples"
describe UnpackStrategy::Jar do describe UnpackStrategy::Jar, :needs_unzip do
let(:path) { TEST_FIXTURE_DIR/"test.jar" } let(:path) { TEST_FIXTURE_DIR/"test.jar" }
include_examples "UnpackStrategy::detect" include_examples "UnpackStrategy::detect"

View File

@ -1,6 +1,6 @@
require_relative "shared_examples" require_relative "shared_examples"
describe UnpackStrategy::Subversion do describe UnpackStrategy::Subversion, :needs_svn do
let(:repo) { mktmpdir } let(:repo) { mktmpdir }
let(:working_copy) { mktmpdir } let(:working_copy) { mktmpdir }
let(:path) { working_copy } let(:path) { working_copy }

View File

@ -4,7 +4,10 @@ describe UnpackStrategy::Zip do
let(:path) { TEST_FIXTURE_DIR/"cask/MyFancyApp.zip" } let(:path) { TEST_FIXTURE_DIR/"cask/MyFancyApp.zip" }
include_examples "UnpackStrategy::detect" include_examples "UnpackStrategy::detect"
include_examples "#extract", children: ["MyFancyApp"]
context "when unzip is available", :needs_unzip do
include_examples "#extract", children: ["MyFancyApp"]
end
context "when ZIP archive is corrupted" do context "when ZIP archive is corrupted" do
let(:path) { let(:path) {