Merge pull request #2434 from JCount/gpg-spec-test-21-compatibility
gpg_spec test add 2.1.x compatibility
This commit is contained in:
commit
4d6e31999a
@ -6,6 +6,7 @@ class Gpg
|
||||
gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0]
|
||||
next unless gpg_short_version
|
||||
gpg_version = Version.create(gpg_short_version.to_s)
|
||||
@version = gpg_version
|
||||
gpg_version == Version.create("2.0") ||
|
||||
gpg_version == Version.create("2.1")
|
||||
end
|
||||
@ -25,6 +26,10 @@ class Gpg
|
||||
File.executable?(GPG_EXECUTABLE.to_s)
|
||||
end
|
||||
|
||||
def self.version
|
||||
@version if available?
|
||||
end
|
||||
|
||||
def self.create_test_key(path)
|
||||
odie "No GPG present to test against!" unless available?
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ describe GPG2Requirement do
|
||||
ENV["PATH"] = dir/"bin"
|
||||
(dir/"bin/gpg").write <<-EOS.undent
|
||||
#!/bin/bash
|
||||
echo 2.0.30
|
||||
echo 2.1.20
|
||||
EOS
|
||||
FileUtils.chmod 0755, dir/"bin/gpg"
|
||||
|
||||
|
||||
@ -13,7 +13,12 @@ describe Gpg do
|
||||
shutup do
|
||||
subject.create_test_key(dir)
|
||||
end
|
||||
expect(dir/".gnupg/secring.gpg").to exist
|
||||
|
||||
if subject.version == Version.create("2.0")
|
||||
expect(dir/".gnupg/secring.gpg").to be_a_file
|
||||
else
|
||||
expect(dir/".gnupg/pubring.kbx").to be_a_file
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user