blob: 05c6ea7f0868e0d02df95cc102e84719b015f0e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
require "formula_installer"
require "hooks/bottles"
RSpec::Matchers.alias_matcher :pour_bottle, :be_pour_bottle
describe Homebrew::Hooks::Bottles do
subject { FormulaInstaller.new formula }
let(:formula) do
double(
bottle: nil,
local_bottle_path: nil,
bottle_disabled?: false,
some_random_method: true,
)
end
after(:each) do
described_class.reset_hooks
end
describe "#setup_formula_has_bottle" do
context "given a block which evaluates to true" do
before(:each) do
described_class.setup_formula_has_bottle(&:some_random_method)
end
it { is_expected.to pour_bottle }
end
context "given a block which evaluates to false" do
before(:each) do
described_class.setup_formula_has_bottle { |f| !f.some_random_method }
end
it { is_expected.not_to pour_bottle }
end
end
describe "#setup_pour_formula_bottle" do
before(:each) do
described_class.setup_formula_has_bottle { true }
described_class.setup_pour_formula_bottle(&:some_random_method)
end
it "does not raise an error" do
expect { subject.pour }.not_to raise_error
end
end
end
|