Convert Blacklist test to spec.

This commit is contained in:
Markus Reiter 2017-02-11 17:33:27 +01:00
parent f531e63949
commit 7be5a6a3d2
2 changed files with 111 additions and 68 deletions

View File

@ -0,0 +1,111 @@
require "blacklist"
RSpec::Matchers.define :be_blacklisted do
match do |actual|
blacklisted?(actual)
end
end
describe "Blacklist" do
context "rubygems" do
%w[gem rubygem rubygems].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "latex" do
%w[latex tex tex-live texlive TexLive].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "pip" do
subject { "pip" }
it { is_expected.to be_blacklisted }
end
context "pil" do
subject { "pil" }
it { is_expected.to be_blacklisted }
end
context "macruby" do
subject { "MacRuby" }
it { is_expected.to be_blacklisted }
end
context "lzma" do
%w[lzma liblzma].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "gtest" do
%w[gtest googletest google-test].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "gmock" do
%w[gmock googlemock google-mock].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "sshpass" do
subject { "sshpass" }
it { is_expected.to be_blacklisted }
end
context "gsutil" do
subject { "gsutil" }
it { is_expected.to be_blacklisted }
end
context "clojure" do
subject { "clojure" }
it { is_expected.to be_blacklisted }
end
context "osmium" do
%w[osmium Osmium].each do |s|
subject { s }
it { is_expected.to be_blacklisted }
end
end
context "gfortran" do
subject { "gfortran" }
it { is_expected.to be_blacklisted }
end
context "play" do
subject { "play" }
it { is_expected.to be_blacklisted }
end
context "haskell_platform" do
subject { "haskell-platform" }
it { is_expected.to be_blacklisted }
end
end

View File

@ -1,68 +0,0 @@
require "testing_env"
require "blacklist"
class BlacklistTests < Homebrew::TestCase
def assert_blacklisted(s)
assert blacklisted?(s), "'#{s}' should be blacklisted"
end
def test_rubygems
%w[gem rubygem rubygems].each { |s| assert_blacklisted s }
end
def test_latex
%w[latex tex tex-live texlive TexLive].each { |s| assert_blacklisted s }
end
def test_pip
assert_blacklisted "pip"
end
def test_pil
assert_blacklisted "pil"
end
def test_macruby
assert_blacklisted "MacRuby"
end
def test_lzma
%w[lzma liblzma].each { |s| assert_blacklisted s }
end
def test_gtest
%w[gtest googletest google-test].each { |s| assert_blacklisted s }
end
def test_gmock
%w[gmock googlemock google-mock].each { |s| assert_blacklisted s }
end
def test_sshpass
assert_blacklisted "sshpass"
end
def test_gsutil
assert_blacklisted "gsutil"
end
def test_clojure
assert_blacklisted "clojure"
end
def test_osmium
%w[osmium Osmium].each { |s| assert_blacklisted s }
end
def test_gfortran
assert_blacklisted "gfortran"
end
def test_play
assert_blacklisted "play"
end
def test_haskell_platform
assert_blacklisted "haskell-platform"
end
end