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
2a750619
Commit
2a750619
authored
8 years ago
by
Markus Reiter
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2208 from reitermarkus/spec-uninstall
Convert `brew uninstall` test to spec.
parents
c66b840f
3ae115bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/test/cmd/uninstall_spec.rb
+64
-0
64 additions, 0 deletions
Library/Homebrew/test/cmd/uninstall_spec.rb
Library/Homebrew/test/uninstall_test.rb
+0
-62
0 additions, 62 deletions
Library/Homebrew/test/uninstall_test.rb
with
64 additions
and
62 deletions
Library/Homebrew/test/cmd/uninstall_spec.rb
+
64
−
0
View file @
2a750619
require
"cmd/uninstall"
describe
"brew uninstall"
,
:integration_test
do
it
"uninstalls a given Formula"
do
shutup
do
...
...
@@ -10,3 +12,65 @@ describe "brew uninstall", :integration_test do
.
and
be_a_success
end
end
describe
Homebrew
do
let
(
:dependency
)
{
formula
(
"dependency"
)
{
url
"f-1"
}
}
let
(
:dependent
)
do
formula
(
"dependent"
)
do
url
"f-1"
depends_on
"dependency"
end
end
let
(
:opts
)
{
{
dependency
.
rack
=>
[
Keg
.
new
(
dependency
.
installed_prefix
)]
}
}
before
(
:each
)
do
[
dependency
,
dependent
].
each
do
|
f
|
f
.
installed_prefix
.
mkpath
Keg
.
new
(
f
.
installed_prefix
).
optlink
end
tab
=
Tab
.
empty
tab
.
homebrew_version
=
"1.1.6"
tab
.
tabfile
=
dependent
.
installed_prefix
/
Tab
::
FILENAME
tab
.
runtime_dependencies
=
[
{
"full_name"
=>
"dependency"
,
"version"
=>
"1"
},
]
tab
.
write
stub_formula_loader
dependency
stub_formula_loader
dependent
end
describe
"::handle_unsatisfied_dependents"
do
specify
"when developer"
do
expect
{
described_class
.
handle_unsatisfied_dependents
(
opts
)
}.
to
output
(
/Warning/
).
to_stderr
expect
(
described_class
).
not_to
have_failed
end
specify
"when not developer"
do
run_as_not_developer
do
expect
{
described_class
.
handle_unsatisfied_dependents
(
opts
)
}.
to
output
(
/Error/
).
to_stderr
expect
(
described_class
).
to
have_failed
end
end
specify
"when not developer and --ignore-dependencies is specified"
do
ARGV
<<
"--ignore-dependencies"
run_as_not_developer
do
expect
{
described_class
.
handle_unsatisfied_dependents
(
opts
)
}.
not_to
output
.
to_stderr
expect
(
described_class
).
not_to
have_failed
end
end
end
end
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/uninstall_test.rb
deleted
100644 → 0
+
0
−
62
View file @
c66b840f
require
"testing_env"
require
"cmd/uninstall"
class
UninstallTests
<
Homebrew
::
TestCase
def
setup
super
@dependency
=
formula
(
"dependency"
)
{
url
"f-1"
}
@dependent
=
formula
(
"dependent"
)
do
url
"f-1"
depends_on
"dependency"
end
[
@dependency
,
@dependent
].
each
do
|
f
|
f
.
installed_prefix
.
mkpath
Keg
.
new
(
f
.
installed_prefix
).
optlink
end
tab
=
Tab
.
empty
tab
.
homebrew_version
=
"1.1.6"
tab
.
tabfile
=
@dependent
.
installed_prefix
/
Tab
::
FILENAME
tab
.
runtime_dependencies
=
[
{
"full_name"
=>
"dependency"
,
"version"
=>
"1"
},
]
tab
.
write
stub_formula_loader
@dependency
stub_formula_loader
@dependent
end
def
teardown
Homebrew
.
failed
=
false
super
end
def
handle_unsatisfied_dependents
capture_stderr
do
opts
=
{
@dependency
.
rack
=>
[
Keg
.
new
(
@dependency
.
installed_prefix
)]
}
Homebrew
.
handle_unsatisfied_dependents
(
opts
)
end
end
def
test_check_for_testball_f2s_when_developer
assert_match
"Warning"
,
handle_unsatisfied_dependents
refute_predicate
Homebrew
,
:failed?
end
def
test_check_for_dependents_when_not_developer
run_as_not_developer
do
assert_match
"Error"
,
handle_unsatisfied_dependents
assert_predicate
Homebrew
,
:failed?
end
end
def
test_check_for_dependents_when_ignore_dependencies
ARGV
<<
"--ignore-dependencies"
run_as_not_developer
do
assert_empty
handle_unsatisfied_dependents
refute_predicate
Homebrew
,
:failed?
end
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