Merge pull request #2077 from reitermarkus/spec-gpg2_requirement
Convert GPG2Requirement test to spec.
This commit is contained in:
commit
1326f5be57
23
Library/Homebrew/test/gpg2_requirement_spec.rb
Normal file
23
Library/Homebrew/test/gpg2_requirement_spec.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require "requirements/gpg2_requirement"
|
||||
require "fileutils"
|
||||
|
||||
describe GPG2Requirement do
|
||||
let(:dir) { @dir = Pathname.new(Dir.mktmpdir) }
|
||||
|
||||
after(:each) do
|
||||
FileUtils.rm_rf dir unless @dir.nil?
|
||||
end
|
||||
|
||||
describe "#satisfied?" do
|
||||
it "returns true if GPG2 is installed" do
|
||||
ENV["PATH"] = dir/"bin"
|
||||
(dir/"bin/gpg").write <<-EOS.undent
|
||||
#!/bin/bash
|
||||
echo 2.0.30
|
||||
EOS
|
||||
FileUtils.chmod 0755, dir/"bin/gpg"
|
||||
|
||||
expect(subject).to be_satisfied
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,25 +0,0 @@
|
||||
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
|
||||
ENV["PATH"] = @dir/"bin"
|
||||
assert_predicate GPG2Requirement.new, :satisfied?
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user