Skip to content

Commit

Permalink
Skip some tests if gpg is not available (Issue#8).
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Mar 26, 2012
1 parent b5f922b commit 9be29cb
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 7 deletions.
4 changes: 4 additions & 0 deletions test/crypto_test.rb
Expand Up @@ -3,6 +3,10 @@
require 'tempfile'

describe GPGME::Crypto do
before do
skip unless GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
end

describe "default options functionality" do
it "allows operation from instances normally" do
crypto = GPGME::Crypto.new
Expand Down
4 changes: 4 additions & 0 deletions test/ctx_test.rb
Expand Up @@ -2,6 +2,10 @@
require 'test_helper'

describe GPGME::Ctx do
before do
skip unless GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
end

it "can instantiate" do
assert_instance_of GPGME::Ctx, GPGME::Ctx.new
end
Expand Down
3 changes: 3 additions & 0 deletions test/key_test.rb
Expand Up @@ -2,6 +2,9 @@
require 'test_helper'

describe GPGME::Key do
before do
skip unless GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
end

it "has certain attributes" do
key = GPGME::Key.find(:secret).first
Expand Down
4 changes: 4 additions & 0 deletions test/signature_test.rb
Expand Up @@ -2,6 +2,10 @@
require 'test_helper'

describe GPGME::Signature do
before do
skip unless GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
end

it "#valid? is true when the signature is valid" do
crypto = GPGME::Crypto.new
signatures = 0
Expand Down
3 changes: 3 additions & 0 deletions test/sub_key_test.rb
Expand Up @@ -2,6 +2,9 @@
require 'test_helper'

describe GPGME::SubKey do
before do
skip unless GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
end

# We trust Key for common methods that come from KeyCommon

Expand Down
16 changes: 9 additions & 7 deletions test/test_helper.rb
Expand Up @@ -74,10 +74,12 @@ def without_key(key, &block)
end
end

# We use a different home directory for the keys to not disturb current
# installation

require 'tmpdir'
GPGME::Engine.home_dir = Dir.tmpdir
remove_all_keys
import_keys
if GPGME::Engine.check_version GPGME::PROTOCOL_OpenPGP
# We use a different home directory for the keys to not disturb current
# installation

require 'tmpdir'
GPGME::Engine.home_dir = Dir.tmpdir
remove_all_keys
import_keys
end

0 comments on commit 9be29cb

Please sign in to comment.