brew/Library/Homebrew/test/gpg2_requirement_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

27 lines
518 B
Ruby

require "testing_env"
require "requirements/gpg2_requirement"
require "fileutils"
class GPG2RequirementTests < Homebrew::TestCase
def setup
super
@dir = Pathname.new(mktmpdir)
(@dir/"bin/gpg").write <<-EOS.undent
#!/bin/bash
echo 2.0.30
EOS
FileUtils.chmod 0755, @dir/"bin/gpg"
end
def teardown
FileUtils.rm_rf @dir
super
end
def test_satisfied
with_environment("PATH" => @dir/"bin") do
assert_predicate GPG2Requirement.new, :satisfied?
end
end
end