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
Boxiang Sun
gitlab-ce
Commits
4641514c
Commit
4641514c
authored
9 years ago
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update rspec tests to the new external issue logic.
parent
65e70047
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
53 deletions
+31
-53
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+0
-1
app/assets/javascripts/project_new.js.coffee
app/assets/javascripts/project_new.js.coffee
+0
-14
spec/factories/projects.rb
spec/factories/projects.rb
+14
-2
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+7
-4
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+10
-11
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+0
-21
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
4641514c
...
...
@@ -99,7 +99,6 @@ class Dispatcher
switch
path
[
1
]
when
'edit'
shortcut_handler
=
new
ShortcutsNavigation
()
new
ProjectNew
()
when
'new'
new
ProjectNew
()
when
'show'
...
...
This diff is collapsed.
Click to expand it.
app/assets/javascripts/project_new.js.coffee
View file @
4641514c
...
...
@@ -9,17 +9,3 @@ class @ProjectNew
initEvents
:
->
disableButtonIfEmptyField
'#project_name'
,
'.project-submit'
$
(
'#project_issues_enabled'
).
change
->
if
(
$
(
this
).
is
(
':checked'
)
==
true
)
$
(
'#project_issues_tracker'
).
removeAttr
(
'disabled'
)
else
$
(
'#project_issues_tracker'
).
attr
(
'disabled'
,
'disabled'
)
$
(
'#project_issues_tracker'
).
change
()
$
(
'#project_issues_tracker'
).
change
->
if
(
$
(
this
).
val
()
==
gon
.
default_issues_tracker
||
$
(
this
).
is
(
':disabled'
))
$
(
'#project_issues_tracker_id'
).
attr
(
'disabled'
,
'disabled'
)
else
$
(
'#project_issues_tracker_id'
).
removeAttr
(
'disabled'
)
This diff is collapsed.
Click to expand it.
spec/factories/projects.rb
View file @
4641514c
...
...
@@ -76,7 +76,19 @@ FactoryGirl.define do
end
factory
:redmine_project
,
parent: :project
do
issues_tracker
{
"redmine"
}
issues_tracker_id
{
"project_name_in_redmine"
}
after
:create
do
|
project
|
project
.
create_redmine_service
(
active:
true
,
properties:
{
project_url:
'http://redmine/projects/project_name_in_redmine'
,
issues_url:
"http://redmine/
#{
project
.
id
}
/project_name_in_redmine/:id"
,
new_issue_url:
'http://redmine/projects/project_name_in_redmine/issues/new'
}
)
end
after
:create
do
|
project
|
project
.
issues_tracker
=
'redmine'
project
.
issues_tracker_id
=
'project_name_in_redmine'
end
end
end
This diff is collapsed.
Click to expand it.
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
4641514c
...
...
@@ -296,10 +296,13 @@ describe GitlabMarkdownHelper do
let
(
:reference
)
{
"JIRA-
#{
issue
.
iid
}
"
}
before
do
issue_tracker_config
=
{
"jira"
=>
{
"title"
=>
"JIRA tracker"
,
"issues_url"
=>
"http://jira.example/browse/:id"
}
}
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
issue_tracker_config
)
@project
.
stub
(
:issues_tracker
).
and_return
(
"jira"
)
@project
.
stub
(
:issues_tracker_id
).
and_return
(
"JIRA"
)
jira
=
@project
.
create_jira_service
if
@project
.
jira_service
.
nil?
properties
=
{
"title"
=>
"JIRA tracker"
,
"project_url"
=>
"http://jira.example/issues/?jql=project=A"
,
"issues_url"
=>
"http://jira.example/browse/:id"
,
"new_issue_url"
=>
"http://jira.example/secure/CreateIssue.jspa"
}
jira
.
update_attributes
(
properties:
properties
,
active:
true
)
end
after
do
@project
.
jira_service
.
destroy!
unless
@project
.
jira_service
.
nil?
end
it
"should link using a valid id"
do
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/issues_helper_spec.rb
View file @
4641514c
...
...
@@ -24,7 +24,7 @@ describe IssuesHelper do
end
describe
:url_for_project_issues
do
let
(
:project_url
)
{
Gitlab
.
config
.
issues_tracker
.
redmine
.
project_url
}
let
(
:project_url
)
{
ext_project
.
external_issue_tracker
.
project_url
}
let
(
:ext_expected
)
do
project_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
...
...
@@ -54,17 +54,16 @@ describe IssuesHelper do
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
nil
)
end
it
"should return path to
in
ternal tracker"
do
url_for_project_issues
.
should
match
(
polymorphic_path
([
@project
])
)
it
"should return path to
ex
ternal tracker"
do
url_for_project_issues
.
should
match
(
ext_expected
)
end
end
end
describe
:url_for_issue
do
let
(
:issue_id
)
{
3
}
let
(
:issues_url
)
{
Gitlab
.
config
.
issues_tracker
.
redmine
.
issues_url
}
let
(
:issues_url
)
{
ext_project
.
external_issue_tracker
.
issues_url
}
let
(
:ext_expected
)
do
issues_url
.
gsub
(
':id'
,
issue
_
id
.
to_s
)
issues_url
.
gsub
(
':id'
,
issue
.
i
id
.
to_s
)
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
end
...
...
@@ -78,7 +77,7 @@ describe IssuesHelper do
it
"should return path to external tracker"
do
@project
=
ext_project
url_for_issue
(
issue
_
id
).
should
match
(
ext_expected
)
url_for_issue
(
issue
.
i
id
).
should
match
(
ext_expected
)
end
it
"should return empty string if project nil"
do
...
...
@@ -93,14 +92,14 @@ describe IssuesHelper do
Gitlab
.
config
.
stub
(
:issues_tracker
).
and_return
(
nil
)
end
it
"should return
in
ternal path"
do
url_for_issue
(
issue
.
iid
).
should
match
(
polymorphic_path
([
@project
,
issue
])
)
it
"should return
ex
ternal path"
do
url_for_issue
(
issue
.
iid
).
should
match
(
ext_expected
)
end
end
end
describe
:url_for_new_issue
do
let
(
:issues_url
)
{
Gitlab
.
config
.
issues_tracker
.
redmine
.
new_issue_url
}
let
(
:issues_url
)
{
ext_project
.
external_issue_tracker
.
new_issue_url
}
let
(
:ext_expected
)
do
issues_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
...
...
@@ -131,7 +130,7 @@ describe IssuesHelper do
end
it
"should return internal path"
do
url_for_new_issue
.
should
match
(
new_project_issue_path
(
@project
)
)
url_for_new_issue
.
should
match
(
ext_expected
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
spec/helpers/projects_helper_spec.rb
View file @
4641514c
require
'spec_helper'
describe
ProjectsHelper
do
describe
'#project_issues_trackers'
do
it
"returns the correct issues trackers available"
do
project_issues_trackers
.
should
==
"<option value=
\"
redmine
\"
>Redmine</option>
\n
"
\
"<option value=
\"
gitlab
\"
>GitLab</option>"
end
it
"returns the correct issues trackers available with current tracker 'gitlab' selected"
do
project_issues_trackers
(
'gitlab'
).
should
==
"<option value=
\"
redmine
\"
>Redmine</option>
\n
"
\
"<option selected=
\"
selected
\"
value=
\"
gitlab
\"
>GitLab</option>"
end
it
"returns the correct issues trackers available with current tracker 'redmine' selected"
do
project_issues_trackers
(
'redmine'
).
should
==
"<option selected=
\"
selected
\"
value=
\"
redmine
\"
>Redmine</option>
\n
"
\
"<option value=
\"
gitlab
\"
>GitLab</option>"
end
end
describe
"#project_status_css_class"
do
it
"returns appropriate class"
do
project_status_css_class
(
"started"
).
should
==
"active"
project_status_css_class
(
"failed"
).
should
==
"danger"
project_status_css_class
(
"finished"
).
should
==
"success"
end
end
end
This diff is collapsed.
Click to expand it.
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