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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0a57c518
Commit
0a57c518
authored
Feb 26, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for Gitlab::Plugin [ci skip]
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
ee4abd85
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
spec/lib/gitlab/plugin_spec.rb
spec/lib/gitlab/plugin_spec.rb
+39
-0
No files found.
spec/lib/gitlab/plugin_spec.rb
0 → 100644
View file @
0a57c518
require
'spec_helper'
describe
Gitlab
::
Plugin
do
describe
'.execute'
do
let
(
:data
)
{
Gitlab
::
DataBuilder
::
Push
::
SAMPLE_DATA
}
let
(
:plugin
)
{
Rails
.
root
.
join
(
'plugins'
,
'test.rb'
)
}
let
(
:tmp_file
)
{
Tempfile
.
new
(
'plugin-dump'
).
path
}
before
do
File
.
write
(
plugin
,
plugin_source
)
File
.
chmod
(
0
o777
,
plugin
)
end
after
do
FileUtils
.
rm
(
plugin
)
FileUtils
.
rm
(
tmp_file
)
end
subject
{
described_class
.
execute
(
plugin
.
to_s
,
data
)
}
it
{
is_expected
.
to
be
true
}
it
'ensures plugin received data via stdin'
do
subject
expect
(
File
.
read
(
tmp_file
)).
to
eq
(
data
.
to_json
)
end
end
private
def
plugin_source
<<-
EOS
#!/usr/bin/env ruby
x = STDIN.read
File.write('
#{
tmp_file
}
', x)
EOS
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