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
cfed0773
Commit
cfed0773
authored
8 years ago
by
Markus Reiter
Browse files
Options
Downloads
Patches
Plain Diff
Convert Homebrew::Hooks::Bottles test to spec.
parent
f8e5716b
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/bottle_hooks_spec.rb
+50
-0
50 additions, 0 deletions
Library/Homebrew/test/bottle_hooks_spec.rb
Library/Homebrew/test/bottle_hooks_test.rb
+0
-49
0 additions, 49 deletions
Library/Homebrew/test/bottle_hooks_test.rb
with
50 additions
and
49 deletions
Library/Homebrew/test/bottle_hooks_spec.rb
0 → 100644
+
50
−
0
View file @
cfed0773
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
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/bottle_hooks_test.rb
deleted
100644 → 0
+
0
−
49
View file @
f8e5716b
require
"testing_env"
require
"formula_installer"
require
"hooks/bottles"
class
BottleHookTests
<
Homebrew
::
TestCase
class
FormulaDouble
def
bottle
;
end
def
local_bottle_path
;
end
def
bottle_disabled?
false
end
def
some_random_method
true
end
end
def
setup
super
@fi
=
FormulaInstaller
.
new
FormulaDouble
.
new
end
def
test_has_bottle
Homebrew
::
Hooks
::
Bottles
.
setup_formula_has_bottle
(
&
:some_random_method
)
assert_predicate
@fi
,
:pour_bottle?
end
def
test_has_no_bottle
Homebrew
::
Hooks
::
Bottles
.
setup_formula_has_bottle
do
|
f
|
!
f
.
some_random_method
end
refute_predicate
@fi
,
:pour_bottle?
end
def
test_pour_formula_bottle
Homebrew
::
Hooks
::
Bottles
.
setup_formula_has_bottle
do
|
_f
|
true
end
Homebrew
::
Hooks
::
Bottles
.
setup_pour_formula_bottle
(
&
:some_random_method
)
@fi
.
pour
end
def
teardown
Homebrew
::
Hooks
::
Bottles
.
reset_hooks
super
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