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
3b27a458
Commit
3b27a458
authored
Jul 22, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for presenter methods
Added specs to each of the presenters for the new web_path method
parent
e1670b92
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
0 deletions
+39
-0
changelogs/unreleased/ph-repoBrowserWebPathDescriptionFields.yml
...ogs/unreleased/ph-repoBrowserWebPathDescriptionFields.yml
+5
-0
spec/presenters/blob_presenter_spec.rb
spec/presenters/blob_presenter_spec.rb
+10
-0
spec/presenters/commit_presenter_spec.rb
spec/presenters/commit_presenter_spec.rb
+4
-0
spec/presenters/tree_entry_presenter_spec.rb
spec/presenters/tree_entry_presenter_spec.rb
+4
-0
spec/presenters/user_presenter_spec.rb
spec/presenters/user_presenter_spec.rb
+16
-0
No files found.
changelogs/unreleased/ph-repoBrowserWebPathDescriptionFields.yml
0 → 100644
View file @
3b27a458
---
title
:
Added webPath and descriptionHtml types to the repository GraphQL entities
merge_request
:
37416
author
:
type
:
added
spec/presenters/blob_presenter_spec.rb
View file @
3b27a458
...
...
@@ -24,6 +24,16 @@ RSpec.describe BlobPresenter, :seed_helper do
it
{
expect
(
subject
.
web_url
).
to
eq
(
"http://localhost/
#{
project
.
full_path
}
/-/blob/
#{
blob
.
commit_id
}
/
#{
blob
.
path
}
"
)
}
end
describe
'.web_path'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository
)
{
project
.
repository
}
let
(
:blob
)
{
Gitlab
::
Graphql
::
Representation
::
TreeEntry
.
new
(
repository
.
tree
.
blobs
.
first
,
repository
)
}
subject
{
described_class
.
new
(
blob
)
}
it
{
expect
(
subject
.
web_path
).
to
eq
(
"/
#{
project
.
full_path
}
/-/blob/
#{
blob
.
commit_id
}
/
#{
blob
.
path
}
"
)
}
end
describe
'#highlight'
do
subject
{
described_class
.
new
(
blob
)
}
...
...
spec/presenters/commit_presenter_spec.rb
View file @
3b27a458
...
...
@@ -8,6 +8,10 @@ RSpec.describe CommitPresenter do
let
(
:user
)
{
create
(
:user
)
}
let
(
:presenter
)
{
described_class
.
new
(
commit
,
current_user:
user
)
}
describe
'.web_path'
do
it
{
expect
(
presenter
.
web_path
).
to
eq
(
"/
#{
project
.
full_path
}
/-/commit/
#{
commit
.
sha
}
"
)
}
end
describe
'#status_for'
do
subject
{
presenter
.
status_for
(
'ref'
)
}
...
...
spec/presenters/tree_entry_presenter_spec.rb
View file @
3b27a458
...
...
@@ -13,4 +13,8 @@ RSpec.describe TreeEntryPresenter do
describe
'.web_url'
do
it
{
expect
(
presenter
.
web_url
).
to
eq
(
"http://localhost/
#{
project
.
full_path
}
/-/tree/
#{
tree
.
commit_id
}
/
#{
tree
.
path
}
"
)
}
end
describe
'.web_path'
do
it
{
expect
(
presenter
.
web_path
).
to
eq
(
"/
#{
project
.
full_path
}
/-/tree/
#{
tree
.
commit_id
}
/
#{
tree
.
path
}
"
)
}
end
end
spec/presenters/user_presenter_spec.rb
0 → 100644
View file @
3b27a458
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
UserPresenter
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:presenter
)
{
described_class
.
new
(
user
)
}
describe
'.web_path'
do
it
{
expect
(
presenter
.
web_path
).
to
eq
(
"/
#{
user
.
username
}
"
)
}
end
describe
'.web_url'
do
it
{
expect
(
presenter
.
web_url
).
to
eq
(
"http://localhost/
#{
user
.
username
}
"
)
}
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