brew/Library/Homebrew/test/gpg_test.rb
Alyssa Ross 70a381a00f tests: enforce super in lifecycle hooks
This will allow us to have global setup and teardown for tests.

For example, we can automatically clear caches after each test, to avoid
annoying intermittent failures like #1879 and #1886.
2017-01-21 11:34:52 +00:00

22 lines
434 B
Ruby

require "testing_env"
require "gpg"
class GpgTest < Homebrew::TestCase
def setup
super
skip "GPG Unavailable" unless Gpg.available?
@dir = Pathname.new(mktmpdir)
end
def test_create_test_key
Dir.chdir(@dir) do
with_environment("HOME" => @dir) do
shutup { Gpg.create_test_key(@dir) }
assert_predicate @dir/".gnupg/secring.gpg", :exist?
end
end
ensure
@dir.rmtree
end
end