Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
c8df6bcf
Commit
c8df6bcf
authored
Jul 26, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some rspec deprecations
parent
f2eb95f0
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
126 additions
and
129 deletions
+126
-129
spec/gitlab_access_spec.rb
spec/gitlab_access_spec.rb
+9
-9
spec/gitlab_keys_spec.rb
spec/gitlab_keys_spec.rb
+39
-40
spec/gitlab_lfs_authentication_spec.rb
spec/gitlab_lfs_authentication_spec.rb
+6
-6
spec/gitlab_logger_spec.rb
spec/gitlab_logger_spec.rb
+1
-1
spec/gitlab_net_spec.rb
spec/gitlab_net_spec.rb
+61
-63
spec/gitlab_post_receive_spec.rb
spec/gitlab_post_receive_spec.rb
+7
-7
spec/names_helper_spec.rb
spec/names_helper_spec.rb
+3
-3
No files found.
spec/gitlab_access_spec.rb
View file @
c8df6bcf
...
...
@@ -3,8 +3,8 @@ require 'gitlab_access'
describe
GitlabAccess
do
let
(
:repository_path
)
{
"/home/git/repositories"
}
let
(
:repo_name
)
{
'dzaporozhets/gitlab-ci'
}
let
(
:repo_path
)
{
File
.
join
(
repository_path
,
repo_name
)
+
".git"
}
let
(
:repo_name
)
{
'dzaporozhets/gitlab-ci'
}
let
(
:repo_path
)
{
File
.
join
(
repository_path
,
repo_name
)
+
".git"
}
let
(
:api
)
do
double
(
GitlabNet
).
tap
do
|
api
|
api
.
stub
(
check_access:
GitAccessStatus
.
new
(
true
,
...
...
@@ -17,19 +17,19 @@ describe GitlabAccess do
end
subject
do
GitlabAccess
.
new
(
nil
,
repo_path
,
'key-123'
,
'wow'
,
'ssh'
).
tap
do
|
access
|
a
ccess
.
stub
(
exec_cmd:
:exec_called
)
a
ccess
.
stub
(
api:
api
)
a
llow
(
access
).
to
receive
(
:exec_cmd
).
and_return
(
:exec_called
)
a
llow
(
access
).
to
receive
(
:api
).
and_return
(
api
)
end
end
before
do
GitlabConfig
.
any_instance
.
stub
(
repos_path:
repository_path
)
allow_any_instance_of
(
GitlabConfig
).
to
receive
(
:repos_path
).
and_return
(
repository_path
)
end
describe
:initialize
do
it
{
subject
.
repo_path
.
should
==
repo_path
}
it
{
subject
.
changes
.
should
==
[
'wow'
]
}
it
{
subject
.
protocol
.
should
==
'ssh'
}
it
{
expect
(
subject
.
send
(
:repo_path
)).
to
eql
repo_path
}
# FIXME: don't access private instance variables
it
{
expect
(
subject
.
send
(
:changes
)).
to
eql
[
'wow'
]
}
# FIXME: don't access private instance variables
it
{
expect
(
subject
.
send
(
:protocol
)).
to
eql
'ssh'
}
# FIXME: don't access private instance variables
end
describe
"#exec"
do
...
...
@@ -61,7 +61,7 @@ describe GitlabAccess do
context
"API connection fails"
do
before
do
a
pi
.
stub
(
:check_access
).
and_raise
(
GitlabNet
::
ApiUnreachableError
)
a
llow
(
api
).
to
receive
(
:check_access
).
and_raise
(
GitlabNet
::
ApiUnreachableError
)
end
it
"returns false"
do
...
...
spec/gitlab_keys_spec.rb
View file @
c8df6bcf
This diff is collapsed.
Click to expand it.
spec/gitlab_lfs_authentication_spec.rb
View file @
c8df6bcf
...
...
@@ -16,22 +16,22 @@ describe GitlabLfsAuthentication do
end
describe
'#build_from_json'
do
it
{
subject
.
username
.
should
==
'dzaporozhets'
}
it
{
subject
.
lfs_token
.
should
==
'wsnys8Zm8Jn7zyhHTAAK'
}
it
{
subject
.
repository_http_path
.
should
==
'http://gitlab.dev/repo'
}
it
{
expect
(
subject
.
username
).
to
eql
'dzaporozhets'
}
it
{
expect
(
subject
.
lfs_token
).
to
eql
'wsnys8Zm8Jn7zyhHTAAK'
}
it
{
expect
(
subject
.
repository_http_path
).
to
eql
'http://gitlab.dev/repo'
}
end
describe
'#authentication_payload'
do
result
=
"{
\"
header
\"
:{
\"
Authorization
\"
:
\"
Basic ZHphcG9yb3poZXRzOndzbnlzOFptOEpuN3p5aEhUQUFL
\"
},
\"
href
\"
:
\"
http://gitlab.dev/repo/info/lfs/
\"
}"
it
{
subject
.
authentication_payload
.
should
eq
(
result
)
}
it
{
expect
(
subject
.
authentication_payload
).
to
eq
(
result
)
}
it
'should be a proper JSON'
do
payload
=
subject
.
authentication_payload
json_payload
=
JSON
.
parse
(
payload
)
json_payload
[
'header'
][
'Authorization'
].
should
eq
(
'Basic ZHphcG9yb3poZXRzOndzbnlzOFptOEpuN3p5aEhUQUFL'
)
json_payload
[
'href'
].
should
eq
(
'http://gitlab.dev/repo/info/lfs/'
)
expect
(
json_payload
[
'header'
][
'Authorization'
]).
to
eq
(
'Basic ZHphcG9yb3poZXRzOndzbnlzOFptOEpuN3p5aEhUQUFL'
)
expect
(
json_payload
[
'href'
]).
to
eq
(
'http://gitlab.dev/repo/info/lfs/'
)
end
end
end
spec/gitlab_logger_spec.rb
View file @
c8df6bcf
...
...
@@ -6,7 +6,7 @@ describe :convert_log_level do
subject
{
convert_log_level
:extreme
}
it
"converts invalid log level to Logger::INFO"
do
$stderr
.
should_
receive
(
:puts
).
at_least
(
:once
)
expect
(
$stderr
).
to
receive
(
:puts
).
at_least
(
:once
)
should
eq
(
Logger
::
INFO
)
end
end
...
...
spec/gitlab_net_spec.rb
View file @
c8df6bcf
This diff is collapsed.
Click to expand it.
spec/gitlab_post_receive_spec.rb
View file @
c8df6bcf
...
...
@@ -31,7 +31,7 @@ describe GitlabPostReceive do
before
do
$logger
=
double
(
'logger'
).
as_null_object
# Global vars are bad
GitlabConfig
.
any_instance
.
stub
(
repos_path:
repository_path
)
allow_any_instance_of
(
GitlabConfig
).
to
receive
(
:repos_path
).
and_return
(
repository_path
)
end
describe
"#exec"
do
...
...
@@ -63,7 +63,7 @@ describe GitlabPostReceive do
context
'when contains long url string at end'
do
let
(
:broadcast_message
)
{
"test "
*
10
+
"message "
*
10
+
"https://localhost:5000/test/a/really/long/url/that/is/in/the/broadcast/message/do-not-truncate-when-url"
}
it
'doesnt truncate url'
do
it
'doesnt truncate url'
do
expect_any_instance_of
(
GitlabNet
).
to
receive
(
:post_receive
).
and_return
(
response
)
assert_broadcast_message_printed_keep_long_url_end
(
gitlab_post_receive
)
assert_new_mr_printed
(
gitlab_post_receive
)
...
...
@@ -75,7 +75,7 @@ describe GitlabPostReceive do
context
'when contains long url string at start'
do
let
(
:broadcast_message
)
{
"https://localhost:5000/test/a/really/long/url/that/is/in/the/broadcast/message/do-not-truncate-when-url "
+
"test "
*
10
+
"message "
*
11
}
it
'doesnt truncate url'
do
it
'doesnt truncate url'
do
expect_any_instance_of
(
GitlabNet
).
to
receive
(
:post_receive
).
and_return
(
response
)
assert_broadcast_message_printed_keep_long_url_start
(
gitlab_post_receive
)
assert_new_mr_printed
(
gitlab_post_receive
)
...
...
@@ -87,7 +87,7 @@ describe GitlabPostReceive do
context
'when contains long url string in middle'
do
let
(
:broadcast_message
)
{
"test "
*
11
+
"https://localhost:5000/test/a/really/long/url/that/is/in/the/broadcast/message/do-not-truncate-when-url "
+
"message "
*
11
}
it
'doesnt truncate url'
do
it
'doesnt truncate url'
do
expect_any_instance_of
(
GitlabNet
).
to
receive
(
:post_receive
).
and_return
(
response
)
assert_broadcast_message_printed_keep_long_url_middle
(
gitlab_post_receive
)
assert_new_mr_printed
(
gitlab_post_receive
)
...
...
@@ -198,7 +198,7 @@ describe GitlabPostReceive do
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
" message message message message message message message message"
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
"https://localhost:5000/test/a/really/long/url/that/is/in/the/broadcast/message/do-not-truncate-when-url"
).
ordered
...
...
@@ -215,7 +215,7 @@ describe GitlabPostReceive do
"========================================================================"
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
"https://localhost:5000/test/a/really/long/url/that/is/in/the/broadcast/message/do-not-truncate-when-url"
).
ordered
...
...
@@ -244,7 +244,7 @@ describe GitlabPostReceive do
"========================================================================"
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
ordered
expect
(
gitlab_post_receive
).
to
receive
(
:puts
).
with
(
" test test test test test test test test test test test"
).
ordered
...
...
spec/names_helper_spec.rb
View file @
c8df6bcf
...
...
@@ -5,8 +5,8 @@ describe NamesHelper do
include
NamesHelper
describe
:extract_ref_name
do
it
{
ex
tract_ref_name
(
'refs/heads/awesome-feature'
).
should
==
'awesome-feature'
}
it
{
ex
tract_ref_name
(
'refs/tags/v2.2.1'
).
should
==
'v2.2.1'
}
it
{
ex
tract_ref_name
(
'refs/tags/releases/v2.2.1'
).
should
==
'releases/v2.2.1'
}
it
{
ex
pect
(
extract_ref_name
(
'refs/heads/awesome-feature'
)).
to
eql
'awesome-feature'
}
it
{
ex
pect
(
extract_ref_name
(
'refs/tags/v2.2.1'
)).
to
eql
'v2.2.1'
}
it
{
ex
pect
(
extract_ref_name
(
'refs/tags/releases/v2.2.1'
)).
to
eql
'releases/v2.2.1'
}
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