Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
8016cefa
Commit
8016cefa
authored
Feb 25, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the Gitlab::Popen path argument optional
parent
0432bdf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
lib/gitlab/popen.rb
lib/gitlab/popen.rb
+2
-1
spec/lib/gitlab/popen_spec.rb
spec/lib/gitlab/popen_spec.rb
+9
-0
No files found.
lib/gitlab/popen.rb
View file @
8016cefa
...
@@ -3,11 +3,12 @@ require 'open3'
...
@@ -3,11 +3,12 @@ require 'open3'
module
Gitlab
module
Gitlab
module
Popen
module
Popen
def
popen
(
cmd
,
path
)
def
popen
(
cmd
,
path
=
nil
)
unless
cmd
.
is_a?
(
Array
)
unless
cmd
.
is_a?
(
Array
)
raise
"System commands must be given as an array of strings"
raise
"System commands must be given as an array of strings"
end
end
path
||=
Dir
.
pwd
vars
=
{
"PWD"
=>
path
}
vars
=
{
"PWD"
=>
path
}
options
=
{
chdir:
path
}
options
=
{
chdir:
path
}
...
...
spec/lib/gitlab/popen_spec.rb
View file @
8016cefa
...
@@ -32,5 +32,14 @@ describe 'Gitlab::Popen', no_db: true do
...
@@ -32,5 +32,14 @@ describe 'Gitlab::Popen', no_db: true do
end
end
end
end
context
'without a directory argument'
do
before
do
@output
,
@status
=
@klass
.
new
.
popen
(
%W(ls)
)
end
it
{
@status
.
should
be_zero
}
it
{
@output
.
should
include
(
'spec'
)
}
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment