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
iv
gitlab-ce
Commits
c184eeb8
Commit
c184eeb8
authored
Dec 21, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve `StringPath` specs (DRY)
parent
518b2062
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
spec/lib/gitlab/string_path_spec.rb
spec/lib/gitlab/string_path_spec.rb
+19
-10
No files found.
spec/lib/gitlab/string_path_spec.rb
View file @
c184eeb8
...
@@ -6,6 +6,8 @@ describe Gitlab::StringPath do
...
@@ -6,6 +6,8 @@ describe Gitlab::StringPath do
'path/dir_1/'
,
'path/dir_1/'
,
'path/dir_1/file_1'
,
'path/dir_1/file_1'
,
'path/dir_1/file_b'
,
'path/dir_1/file_b'
,
'path/dir_1/subdir/'
,
'path/dir_1/subdir/subfile'
,
'path/second_dir'
,
'path/second_dir'
,
'path/second_dir/dir_3/file_2'
,
'path/second_dir/dir_3/file_2'
,
'path/second_dir/dir_3/file_3'
,
'path/second_dir/dir_3/file_3'
,
...
@@ -13,8 +15,12 @@ describe Gitlab::StringPath do
...
@@ -13,8 +15,12 @@ describe Gitlab::StringPath do
'/file/with/absolute_path'
]
'/file/with/absolute_path'
]
end
end
describe
'/file/with/absolute_path'
do
def
path
(
example
)
subject
{
described_class
.
new
(
'/file/with/absolute_path'
,
universe
)
}
described_class
.
new
(
example
.
metadata
[
:path
],
universe
)
end
describe
'/file/with/absolute_path'
,
path:
'/file/with/absolute_path'
do
subject
{
|
example
|
path
(
example
)
}
it
{
is_expected
.
to
be_absolute
}
it
{
is_expected
.
to
be_absolute
}
it
{
is_expected
.
to_not
be_relative
}
it
{
is_expected
.
to_not
be_relative
}
...
@@ -22,26 +28,27 @@ describe Gitlab::StringPath do
...
@@ -22,26 +28,27 @@ describe Gitlab::StringPath do
it
{
is_expected
.
to_not
have_parent
}
it
{
is_expected
.
to_not
have_parent
}
describe
'#basename'
do
describe
'#basename'
do
subject
{
described_class
.
new
(
'/file/with/absolute_path'
,
univers
e
).
basename
}
subject
{
|
example
|
path
(
exampl
e
).
basename
}
it
{
is_expected
.
to
eq
'absolute_path'
}
it
{
is_expected
.
to
eq
'absolute_path'
}
end
end
end
end
describe
'path/'
do
describe
'path/'
,
path:
'path/'
do
subject
{
described_class
.
new
(
'path/'
,
univers
e
)
}
subject
{
|
example
|
path
(
exampl
e
)
}
it
{
is_expected
.
to
be_directory
}
it
{
is_expected
.
to
be_directory
}
it
{
is_expected
.
to
be_relative
}
it
{
is_expected
.
to
be_relative
}
it
{
is_expected
.
to_not
have_parent
}
it
{
is_expected
.
to_not
have_parent
}
end
end
describe
'path/dir_1/'
do
describe
'path/dir_1/'
,
path:
'path/dir_1/'
do
subject
{
described_class
.
new
(
'path/dir_1/'
,
universe
)
}
subject
{
|
example
|
path
(
example
)
}
it
{
is_expected
.
to
have_parent
}
it
{
is_expected
.
to
have_parent
}
describe
'#files'
do
describe
'#files'
do
subject
{
described_class
.
new
(
'path/dir_1/'
,
univers
e
).
files
}
subject
{
|
example
|
path
(
exampl
e
).
files
}
pending
{
is_expected
.
to
all
(
be_an_instance_of
described_class
)
}
pending
{
is_expected
.
to
all
(
be_an_instance_of
described_class
)
}
pending
{
is_expected
.
to
be
eq
[
Gitlab
::
StringPath
.
new
(
'path/dir_1/file_1'
,
universe
),
pending
{
is_expected
.
to
be
eq
[
Gitlab
::
StringPath
.
new
(
'path/dir_1/file_1'
,
universe
),
...
@@ -49,12 +56,14 @@ describe Gitlab::StringPath do
...
@@ -49,12 +56,14 @@ describe Gitlab::StringPath do
end
end
describe
'#basename'
do
describe
'#basename'
do
subject
{
described_class
.
new
(
'path/dir_1/'
,
universe
).
basename
}
subject
{
|
example
|
path
(
example
).
basename
}
it
{
is_expected
.
to
eq
'dir_1/'
}
it
{
is_expected
.
to
eq
'dir_1/'
}
end
end
describe
'#parent'
do
describe
'#parent'
do
subject
{
described_class
.
new
(
'path/dir_1/'
,
universe
).
parent
}
subject
{
|
example
|
path
(
example
).
parent
}
it
{
is_expected
.
to
eq
Gitlab
::
StringPath
.
new
(
'path/'
,
universe
)
}
it
{
is_expected
.
to
eq
Gitlab
::
StringPath
.
new
(
'path/'
,
universe
)
}
end
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