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
21d9701f
Commit
21d9701f
authored
Oct 02, 2019
by
Winnie Hellmann
Committed by
Bob Van Landuyt
Oct 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Join IssuablesHelper specs
parent
47f3c6a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
51 deletions
+40
-51
ee/spec/helpers/ee/issuables_helper_spec.rb
ee/spec/helpers/ee/issuables_helper_spec.rb
+40
-29
ee/spec/helpers/issuables_helper_spec.rb
ee/spec/helpers/issuables_helper_spec.rb
+0
-22
No files found.
ee/spec/helpers/ee/issuables_helper_spec.rb
View file @
21d9701f
...
...
@@ -3,42 +3,53 @@
require
'spec_helper'
describe
IssuablesHelper
do
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'#issuable_initial_data'
do
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:can?
).
and_return
(
true
)
stub_commonmark_sourcepos_disabled
end
it
'returns the correct data
for an epic'
do
user
=
create
(
:user
)
epic
=
create
(
:epic
,
author:
user
,
description:
'epic text'
)
@group
=
epic
.
group
context
'
for an epic'
do
it
'returns the correct data'
do
epic
=
create
(
:epic
,
author:
user
,
description:
'epic text'
)
@group
=
epic
.
group
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:can?
).
and_return
(
true
)
expected_data
=
{
endpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
"
,
epicLinksEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/links"
,
updateEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
.json"
,
issueLinksEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/issues"
,
canUpdate:
true
,
canDestroy:
true
,
canAdmin:
true
,
issuableRef:
"&
#{
epic
.
iid
}
"
,
markdownPreviewPath:
"/groups/
#{
@group
.
full_path
}
/preview_markdown"
,
markdownDocsPath:
'/help/user/markdown'
,
issuableTemplateNamesPath:
''
,
lockVersion:
epic
.
lock_version
,
fullPath:
@group
.
full_path
,
groupPath:
@group
.
path
,
initialTitleHtml:
epic
.
title
,
initialTitleText:
epic
.
title
,
initialDescriptionHtml:
'<p dir="auto">epic text</p>'
,
initialDescriptionText:
'epic text'
,
initialTaskStatus:
'0 of 0 tasks completed'
,
projectsEndpoint:
"/api/v4/groups/
#{
@group
.
id
}
/projects"
}
expect
(
helper
.
issuable_initial_data
(
epic
)).
to
eq
(
expected_data
)
end
end
context
'for an issue'
do
it
'returns the correct data that includes canAdmin: true'
do
issue
=
create
(
:issue
,
author:
user
,
description:
'issue text'
)
@project
=
issue
.
project
expected_data
=
{
endpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
"
,
epicLinksEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/links"
,
updateEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
.json"
,
issueLinksEndpoint:
"/groups/
#{
@group
.
full_path
}
/-/epics/
#{
epic
.
iid
}
/issues"
,
canUpdate:
true
,
canDestroy:
true
,
canAdmin:
true
,
issuableRef:
"&
#{
epic
.
iid
}
"
,
markdownPreviewPath:
"/groups/
#{
@group
.
full_path
}
/preview_markdown"
,
markdownDocsPath:
'/help/user/markdown'
,
issuableTemplateNamesPath:
''
,
lockVersion:
epic
.
lock_version
,
fullPath:
@group
.
full_path
,
groupPath:
@group
.
path
,
initialTitleHtml:
epic
.
title
,
initialTitleText:
epic
.
title
,
initialDescriptionHtml:
'<p dir="auto">epic text</p>'
,
initialDescriptionText:
'epic text'
,
initialTaskStatus:
'0 of 0 tasks completed'
,
projectsEndpoint:
"/api/v4/groups/
#{
@group
.
id
}
/projects"
}
expect
(
helper
.
issuable_initial_data
(
epic
)).
to
eq
(
expected_data
)
expect
(
helper
.
issuable_initial_data
(
issue
)).
to
include
(
canAdmin:
true
)
end
end
end
end
ee/spec/helpers/issuables_helper_spec.rb
deleted
100644 → 0
View file @
47f3c6a9
# frozen_string_literal: true
require
'spec_helper'
describe
IssuablesHelper
do
describe
'#issuable_initial_data'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
allow
(
helper
).
to
receive
(
:can?
).
and_return
(
true
)
stub_commonmark_sourcepos_disabled
end
it
'returns the correct data that includes canAdmin: true'
do
issue
=
create
(
:issue
,
author:
user
,
description:
'issue text'
)
@project
=
issue
.
project
expect
(
helper
.
issuable_initial_data
(
issue
)).
to
include
(
canAdmin:
true
)
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