Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
83c42279
Commit
83c42279
authored
8 years ago
by
Markus Reiter
Browse files
Options
Downloads
Patches
Plain Diff
Convert `formula_installer_bottle` test to spec.
parent
14ae87d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/test/formula_installer_bottle_spec.rb
+81
-0
81 additions, 0 deletions
Library/Homebrew/test/formula_installer_bottle_spec.rb
with
81 additions
and
0 deletions
Library/Homebrew/test/formula_installer_bottle_
test
.rb
→
Library/Homebrew/test/formula_installer_bottle_
spec
.rb
+
81
−
0
View file @
83c42279
require
"testing_env"
require
"formula"
require
"formula_installer"
require
"keg"
...
...
@@ -6,22 +5,28 @@ require "tab"
require
"test/support/fixtures/testball"
require
"test/support/fixtures/testball_bottle"
class
InstallBottleTests
<
Homebrew
::
TestCase
def
temporary_bottle_install
(
formula
)
refute_predicate
formula
,
:installed?
assert_predicate
formula
,
:bottled?
assert_predicate
formula
,
:pour_bottle?
RSpec
::
Matchers
.
alias_matcher
:pour_bottle
,
:be_pour_bottle
installer
=
FormulaInstaller
.
new
(
formula
)
describe
FormulaInstaller
do
matcher
:be_poured_from_bottle
do
match
(
&
:poured_from_bottle
)
end
def
temporarily_install_bottle
(
formula
)
expect
(
formula
).
not_to
be_installed
expect
(
formula
).
to
be_bottled
expect
(
formula
).
to
pour_bottle
shutup
{
installer
.
install
}
shutup
do
described_class
.
new
(
formula
).
install
end
keg
=
Keg
.
new
(
formula
.
prefix
)
assert_predicate
formula
,
:
installed
?
expect
(
formula
).
to
be_
installed
begin
assert_predicate
Tab
.
for_keg
(
keg
)
,
:
poured_from_bottle
expect
(
Tab
.
for_keg
(
keg
)
).
to
be_
poured_from_bottle
yield
formula
ensure
...
...
@@ -31,48 +36,46 @@ class InstallBottleTests < Homebrew::TestCase
formula
.
bottle
.
clear_cache
end
refute_predicate
keg
,
:
exist
?
refute_predicate
formula
,
:
installed
?
expect
(
keg
).
not_to
exist
expect
(
formula
).
not_to
be_
installed
end
def
test_a_
basic
_
bottle
_
install
DevelopmentTools
.
stubs
(
:installed?
).
return
s
(
false
)
specify
"
basic
bottle
install
"
do
allow
(
DevelopmentTools
).
to
receive
(
:installed?
).
and_
return
(
false
)
temporar
y_bottle
_install
(
TestballBottle
.
new
)
do
|
f
|
# Copied directly from
test_
formula_installer
.rb as we expect
# the same behavior
temporar
ily
_install
_bottle
(
TestballBottle
.
new
)
do
|
f
|
# Copied directly from formula_installer
_spec.rb
#
as we expect
the same behavior
.
# Test that things made it into the Keg
assert_predicate
f
.
bin
,
:
directory
?
expect
(
f
.
bin
).
to
be_a_
directory
assert_predicate
f
.
libexec
,
:
directory
?
expect
(
f
.
libexec
).
to
be_a_
directory
refute_predicate
f
.
prefix
+
"main.c"
,
:
exist
?
expect
(
f
.
prefix
/
"main.c"
).
not_to
exist
# Test that things ma
k
e it into the Cellar
# Test that things ma
d
e it into the Cellar
keg
=
Keg
.
new
f
.
prefix
keg
.
link
bin
=
HOMEBREW_PREFIX
+
"bin"
assert_predicate
bin
,
:
directory
?
bin
=
HOMEBREW_PREFIX
/
"bin"
expect
(
bin
).
to
be_a_
directory
end
end
def
test_
build
_
tools
_
error
DevelopmentTools
.
stubs
(
:installed?
).
return
s
(
false
)
specify
"
build
tools
error
"
do
allow
(
DevelopmentTools
).
to
receive
(
:installed?
).
and_
return
(
false
)
# Testball doesn't have a bottle block, so use it to test this behavior
formula
=
Testball
.
new
refute_predicate
formula
,
:
installed
?
refute_predicate
formula
,
:
bottled
?
expect
(
formula
).
not_to
be_
installed
expect
(
formula
).
not_to
be_
bottled
installer
=
FormulaInstaller
.
new
(
formula
)
assert_raises
(
BuildToolsError
)
do
installer
.
install
end
expect
{
FormulaInstaller
.
new
(
formula
).
install
}.
to
raise_error
(
BuildToolsError
)
refute_predicate
formula
,
:
installed
?
expect
(
formula
).
not_to
be_
installed
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment