Merge pull request #2189 from reitermarkus/spec-caveats
Convert Caveats test to spec.
This commit is contained in:
commit
46b5890344
29
Library/Homebrew/test/caveats_spec.rb
Normal file
29
Library/Homebrew/test/caveats_spec.rb
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
require "formula"
|
||||||
|
require "caveats"
|
||||||
|
|
||||||
|
describe Caveats do
|
||||||
|
subject { described_class.new(f) }
|
||||||
|
let(:f) { formula { url "foo-1.0" } }
|
||||||
|
|
||||||
|
specify "#f" do
|
||||||
|
expect(subject.f).to eq(f)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#empty?" do
|
||||||
|
it "returns true if the Formula has no caveats" do
|
||||||
|
expect(subject).to be_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false if the Formula has caveats" do
|
||||||
|
f = formula do
|
||||||
|
url "foo-1.0"
|
||||||
|
|
||||||
|
def caveats
|
||||||
|
"something"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(described_class.new(f)).not_to be_empty
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,30 +0,0 @@
|
|||||||
require "testing_env"
|
|
||||||
require "formula"
|
|
||||||
require "caveats"
|
|
||||||
|
|
||||||
class CaveatsTests < Homebrew::TestCase
|
|
||||||
def setup
|
|
||||||
super
|
|
||||||
@f = formula { url "foo-1.0" }
|
|
||||||
@c = Caveats.new @f
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_f
|
|
||||||
assert_equal @f, @c.f
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_empty?
|
|
||||||
assert @c.empty?
|
|
||||||
|
|
||||||
f = formula do
|
|
||||||
url "foo-1.0"
|
|
||||||
|
|
||||||
def caveats
|
|
||||||
"something"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
c = Caveats.new f
|
|
||||||
|
|
||||||
refute c.empty?
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
x
Reference in New Issue
Block a user