FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
github_cli/spec/github_cli/pager_spec.rb at master · danieldeb/github_cli · GitHub
danieldeb
/
github_cli
Public
forked from
piotrmurach/github_cli
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
github_cli
/
spec
/
github_cli
/
pager_spec.rb
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (53 loc) · 1.53 KB
Breadcrumbs
github_cli
/
spec
/
github_cli
/
pager_spec.rb
Copy path
File metadata and controls
64 lines (53 loc) · 1.53 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
require
'spec_helper'
describe
GithubCLI
::
Pager
do
context
'#pager_command'
do
it
'permits custom commands'
do
cmd
=
'more'
GithubCLI
::
System
.
stub
(
:command?
)
{
true
}
described_class
.
pager_command
(
cmd
)
.
should
==
cmd
end
end
context
'#page'
do
let
(
:read_io
)
{
stub
(
:read_io
)
.
as_null_object
}
let
(
:write_io
)
{
stub
(
:write_io
)
.
as_null_object
}
let
(
:pager
)
{
described_class
.
new
}
before
do
$stdout
.
stub
(
:tty?
)
.
and_return
true
IO
.
stub
(
:pipe
)
.
and_return
[
read_io
,
write_io
]
end
context
'child process'
do
before
{
Kernel
.
stub
(
:fork
)
{
false
}
}
it
'pipes to standard output'
do
Kernel
.
stub
(
:fork
)
{
false
}
$stdout
.
should_receive
(
:reopen
)
.
with
(
write_io
)
$stderr
.
should_receive
(
:reopen
)
.
with
(
write_io
)
pager
.
page
end
it
'closes pipe'
do
$stdout
.
stub
(
:reopen
)
$stderr
.
stub
(
:reopen
)
write_io
.
should_receive
(
:close
)
read_io
.
should_receive
(
:close
)
pager
.
page
end
end
context
'parent process'
do
before
do
Kernel
.
stub
(
:fork
)
{
true
}
Kernel
.
stub
(
:select
)
described_class
.
stub
(
:pager_command
)
{
'less'
}
Kernel
.
stub
(
:exec
)
end
it
'reads from standard output'
do
$stdin
.
should_receive
(
:reopen
)
.
with
(
read_io
)
pager
.
page
end
it
'closes pipe'
do
$stdin
.
stub
(
:reopen
)
write_io
.
should_receive
(
:close
)
read_io
.
should_receive
(
:close
)
pager
.
page
end
end
end
end
# GithubCLI::Pager
Back
|
FazBrowse Home
|
New Git URL