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
7f69659a
Commit
7f69659a
authored
Sep 19, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove edit action for issues
parent
69f0370a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
62 additions
and
271 deletions
+62
-271
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-9
app/views/projects/issues/edit.html.haml
app/views/projects/issues/edit.html.haml
+0
-7
changelogs/unreleased/36670-remove-edit-form.yml
changelogs/unreleased/36670-remove-edit-form.yml
+5
-0
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+7
-29
spec/features/issues/form_spec.rb
spec/features/issues/form_spec.rb
+5
-44
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+7
-101
spec/features/projects/issuable_templates_spec.rb
spec/features/projects/issuable_templates_spec.rb
+22
-24
spec/features/security/project/internal_access_spec.rb
spec/features/security/project/internal_access_spec.rb
+0
-15
spec/features/security/project/private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+0
-15
spec/features/security/project/public_access_spec.rb
spec/features/security/project/public_access_spec.rb
+0
-15
spec/support/update_invalid_issuable.rb
spec/support/update_invalid_issuable.rb
+15
-12
No files found.
app/controllers/projects/issues_controller.rb
View file @
7f69659a
...
@@ -16,7 +16,7 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -16,7 +16,7 @@ class Projects::IssuesController < Projects::ApplicationController
before_action
:authorize_create_issue!
,
only:
[
:new
,
:create
]
before_action
:authorize_create_issue!
,
only:
[
:new
,
:create
]
# Allow modify issue
# Allow modify issue
before_action
:authorize_update_issue!
,
only:
[
:
edit
,
:
update
,
:move
]
before_action
:authorize_update_issue!
,
only:
[
:update
,
:move
]
# Allow create a new branch and empty WIP merge request from current issue
# Allow create a new branch and empty WIP merge request from current issue
before_action
:authorize_create_merge_request!
,
only:
[
:create_merge_request
]
before_action
:authorize_create_merge_request!
,
only:
[
:create_merge_request
]
...
@@ -63,10 +63,6 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -63,10 +63,6 @@ class Projects::IssuesController < Projects::ApplicationController
respond_with
(
@issue
)
respond_with
(
@issue
)
end
end
def
edit
respond_with
(
@issue
)
end
def
show
def
show
@noteable
=
@issue
@noteable
=
@issue
@note
=
@project
.
notes
.
new
(
noteable:
@issue
)
@note
=
@project
.
notes
.
new
(
noteable:
@issue
)
...
@@ -126,10 +122,6 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -126,10 +122,6 @@ class Projects::IssuesController < Projects::ApplicationController
@issue
=
Issues
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
(
issue
)
@issue
=
Issues
::
UpdateService
.
new
(
project
,
current_user
,
update_params
).
execute
(
issue
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
recaptcha_check_with_fallback
{
render
:edit
}
end
format
.
json
do
format
.
json
do
render_issue_json
render_issue_json
end
end
...
...
app/views/projects/issues/edit.html.haml
deleted
100644 → 0
View file @
69f0370a
-
page_title
"Edit"
,
"
#{
@issue
.
title
}
(
#{
@issue
.
to_reference
}
)"
,
"Issues"
%h3
.page-title
Edit Issue ##{@issue.iid}
%hr
=
render
"form"
changelogs/unreleased/36670-remove-edit-form.yml
0 → 100644
View file @
7f69659a
---
title
:
Remove the ability to visit the issue edit form directly
merge_request
:
14523
author
:
type
:
removed
spec/controllers/projects/issues_controller_spec.rb
View file @
7f69659a
...
@@ -259,7 +259,7 @@ describe Projects::IssuesController do
...
@@ -259,7 +259,7 @@ describe Projects::IssuesController do
context
'when captcha is not verified'
do
context
'when captcha is not verified'
do
def
update_spam_issue
def
update_spam_issue
update_issue
(
title:
'Spam Title'
,
description:
'Spam lives here'
)
update_issue
(
{
title:
'Spam Title'
,
description:
'Spam lives here'
},
format: :json
)
end
end
before
do
before
do
...
@@ -267,7 +267,6 @@ describe Projects::IssuesController do
...
@@ -267,7 +267,6 @@ describe Projects::IssuesController do
end
end
it
'rejects an issue recognized as a spam'
do
it
'rejects an issue recognized as a spam'
do
expect
(
Gitlab
::
Recaptcha
).
to
receive
(
:load_configurations!
).
and_return
(
true
)
expect
{
update_spam_issue
}.
not_to
change
{
issue
.
reload
.
title
}
expect
{
update_spam_issue
}.
not_to
change
{
issue
.
reload
.
title
}
end
end
...
@@ -287,14 +286,6 @@ describe Projects::IssuesController do
...
@@ -287,14 +286,6 @@ describe Projects::IssuesController do
expect
(
spam_logs
.
first
.
recaptcha_verified
).
to
be_falsey
expect
(
spam_logs
.
first
.
recaptcha_verified
).
to
be_falsey
end
end
context
'as HTML'
do
it
'renders verify template'
do
update_spam_issue
expect
(
response
).
to
render_template
(
:verify
)
end
end
context
'as JSON'
do
context
'as JSON'
do
before
do
before
do
update_issue
({
title:
'Spam Title'
,
description:
'Spam lives here'
},
format: :json
)
update_issue
({
title:
'Spam Title'
,
description:
'Spam lives here'
},
format: :json
)
...
@@ -318,7 +309,7 @@ describe Projects::IssuesController do
...
@@ -318,7 +309,7 @@ describe Projects::IssuesController do
def
update_verified_issue
def
update_verified_issue
update_issue
({
title:
spammy_title
},
update_issue
({
title:
spammy_title
},
{
spam_log_id:
spam_logs
.
last
.
id
,
{
spam_log_id:
spam_logs
.
last
.
id
,
recaptcha_verification:
true
})
recaptcha_verification:
true
,
format: :json
})
end
end
before
do
before
do
...
@@ -326,11 +317,8 @@ describe Projects::IssuesController do
...
@@ -326,11 +317,8 @@ describe Projects::IssuesController do
.
and_return
(
true
)
.
and_return
(
true
)
end
end
it
'redirect to issue page'
do
it
'returns 200 status'
do
update_verified_issue
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
)
.
to
redirect_to
(
project_issue_path
(
project
,
issue
))
end
end
it
'accepts an issue after recaptcha is verified'
do
it
'accepts an issue after recaptcha is verified'
do
...
@@ -574,26 +562,16 @@ describe Projects::IssuesController do
...
@@ -574,26 +562,16 @@ describe Projects::IssuesController do
end
end
end
end
describe
'GET #edit'
do
it_behaves_like
'restricted action'
,
success:
200
def
go
(
id
:)
get
:edit
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
id:
id
end
end
describe
'PUT #update'
do
describe
'PUT #update'
do
it_behaves_like
'restricted action'
,
success:
302
it_behaves_like
'restricted action'
,
success:
200
def
go
(
id
:)
def
go
(
id
:)
put
:update
,
put
:update
,
namespace_id:
project
.
namespace
.
to_param
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
project_id:
project
,
id:
id
,
id:
id
,
issue:
{
title:
'New title'
}
issue:
{
title:
'New title'
},
format: :json
end
end
end
end
end
end
...
...
spec/features/issues/form_spec.rb
View file @
7f69659a
...
@@ -218,54 +218,15 @@ describe 'New/edit issue', :js do
...
@@ -218,54 +218,15 @@ describe 'New/edit issue', :js do
context
'edit issue'
do
context
'edit issue'
do
before
do
before
do
visit
edit_project_issue_path
(
project
,
issue
)
visit
project_issue_path
(
project
,
issue
)
end
page
.
within
(
'.content .issuable-actions'
)
do
click_on
'Edit'
it
'allows user to update issue'
do
expect
(
find
(
'input[name="issue[assignee_ids][]"]'
,
visible:
false
).
value
).
to
match
(
user
.
id
.
to_s
)
expect
(
find
(
'input[name="issue[milestone_id]"]'
,
visible:
false
).
value
).
to
match
(
milestone
.
id
.
to_s
)
expect
(
find
(
'a'
,
text:
'Assign to me'
,
visible:
false
)).
not_to
be_visible
page
.
within
'.js-user-search'
do
expect
(
page
).
to
have_content
user
.
name
end
page
.
within
'.js-milestone-select'
do
expect
(
page
).
to
have_content
milestone
.
title
end
click_button
'Labels'
page
.
within
'.dropdown-menu-labels'
do
click_link
label
.
title
click_link
label2
.
title
end
page
.
within
'.js-label-select'
do
expect
(
page
).
to
have_content
label
.
title
end
expect
(
page
.
all
(
'input[name="issue[label_ids][]"]'
,
visible:
false
)[
1
].
value
).
to
match
(
label
.
id
.
to_s
)
expect
(
page
.
all
(
'input[name="issue[label_ids][]"]'
,
visible:
false
)[
2
].
value
).
to
match
(
label2
.
id
.
to_s
)
click_button
'Save changes'
page
.
within
'.issuable-sidebar'
do
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
user
.
name
end
page
.
within
'.milestone'
do
expect
(
page
).
to
have_content
milestone
.
title
end
page
.
within
'.labels'
do
expect
(
page
).
to
have_content
label
.
title
expect
(
page
).
to
have_content
label2
.
title
end
end
end
end
end
it
'description has autocomplete'
do
it
'description has autocomplete'
do
find
(
'#issue_
description'
).
native
.
send_keys
(
''
)
find
_field
(
'issue-
description'
).
native
.
send_keys
(
''
)
fill_in
'issue
_
description'
,
with:
'@'
fill_in
'issue
-
description'
,
with:
'@'
expect
(
page
).
to
have_selector
(
'.atwho-view'
)
expect
(
page
).
to
have_selector
(
'.atwho-view'
)
end
end
...
...
spec/features/issues_spec.rb
View file @
7f69659a
require
'spec_helper'
require
'spec_helper'
describe
'Issues'
do
describe
'Issues'
,
:js
do
include
DropzoneHelper
include
DropzoneHelper
include
IssueHelpers
include
IssueHelpers
include
SortingHelper
include
SortingHelper
...
@@ -24,109 +24,15 @@ describe 'Issues' do
...
@@ -24,109 +24,15 @@ describe 'Issues' do
end
end
before
do
before
do
visit
edit_project_issue_path
(
project
,
issue
)
visit
project_issue_path
(
project
,
issue
)
find
(
'.js-zen-enter'
).
click
page
.
within
(
'.content .issuable-actions'
)
do
end
find
(
'.issuable-edit'
).
click
it
'opens new issue popup'
do
expect
(
page
).
to
have_content
(
"Issue #
#{
issue
.
iid
}
"
)
end
end
describe
'Editing issue assignee'
do
let!
(
:issue
)
do
create
(
:issue
,
author:
user
,
assignees:
[
user
],
project:
project
)
end
it
'allows user to select unassigned'
,
js:
true
do
visit
edit_project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
"Assignee
#{
user
.
name
}
"
first
(
'.js-user-search'
).
click
click_link
'Unassigned'
click_button
'Save changes'
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
'No assignee - assign yourself'
end
expect
(
issue
.
reload
.
assignees
).
to
be_empty
end
end
describe
'due date'
,
js:
true
do
context
'on new form'
do
before
do
visit
new_project_issue_path
(
project
)
end
it
'saves with due date'
do
date
=
Date
.
today
.
at_beginning_of_month
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
find
(
'#issuable-due-date'
).
click
page
.
within
'.pika-single'
do
click_button
date
.
day
end
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
click_button
'Submit issue'
page
.
within
'.issuable-sidebar'
do
expect
(
page
).
to
have_content
date
.
to_s
(
:medium
)
end
end
end
find
(
'.issue-details .content-block .js-zen-enter'
).
click
end
end
context
'on edit form'
do
it
'opens new issue popup'
do
let
(
:issue
)
{
create
(
:issue
,
author:
user
,
project:
project
,
due_date:
Date
.
today
.
at_beginning_of_month
.
to_s
)
}
expect
(
page
).
to
have_content
(
issue
.
description
)
before
do
visit
edit_project_issue_path
(
project
,
issue
)
end
it
'saves with due date'
do
date
=
Date
.
today
.
at_beginning_of_month
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
date
=
date
.
tomorrow
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
find
(
'#issuable-due-date'
).
click
page
.
within
'.pika-single'
do
click_button
date
.
day
end
expect
(
find
(
'#issuable-due-date'
).
value
).
to
eq
date
.
to_s
click_button
'Save changes'
page
.
within
'.issuable-sidebar'
do
expect
(
page
).
to
have_content
date
.
to_s
(
:medium
)
end
end
it
'warns about version conflict'
do
issue
.
update
(
title:
"New title"
)
fill_in
'issue_title'
,
with:
'bug 345'
fill_in
'issue_description'
,
with:
'bug description'
click_button
'Save changes'
expect
(
page
).
to
have_content
'Someone edited the issue the same time you did'
end
end
end
end
end
...
...
spec/features/projects/issuable_templates_spec.rb
View file @
7f69659a
...
@@ -3,6 +3,7 @@ require 'spec_helper'
...
@@ -3,6 +3,7 @@ require 'spec_helper'
feature
'issuable templates'
,
js:
true
do
feature
'issuable templates'
,
js:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:issue_form_location
)
{
'#content-body .issuable-details .detail-page-description'
}
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
...
@@ -28,14 +29,17 @@ feature 'issuable templates', js: true do
...
@@ -28,14 +29,17 @@ feature 'issuable templates', js: true do
longtemplate_content
,
longtemplate_content
,
message:
'added issue template'
,
message:
'added issue template'
,
branch_name:
'master'
)
branch_name:
'master'
)
visit
edit_project_issue_path
project
,
issue
visit
project_issue_path
project
,
issue
fill_in
:'issue[title]'
,
with:
'test issue title'
page
.
within
(
'.content .issuable-actions'
)
do
click_on
'Edit'
end
fill_in
:'issue-title'
,
with:
'test issue title'
end
end
scenario
'user selects "bug" template'
do
scenario
'user selects "bug" template'
do
select_template
'bug'
select_template
'bug'
wait_for_requests
wait_for_requests
assert_template
assert_template
(
page_part:
issue_form_location
)
save_changes
save_changes
end
end
...
@@ -43,30 +47,19 @@ feature 'issuable templates', js: true do
...
@@ -43,30 +47,19 @@ feature 'issuable templates', js: true do
select_template
'bug'
select_template
'bug'
wait_for_requests
wait_for_requests
select_option
'No template'
select_option
'No template'
assert_template
(
''
)
assert_template
(
expected_content:
''
,
page_part:
issue_form_location
)
save_changes
(
''
)
save_changes
(
''
)
end
end
scenario
'user selects "bug" template, edits description and then selects "reset template"'
do
scenario
'user selects "bug" template, edits description and then selects "reset template"'
do
select_template
'bug'
select_template
'bug'
wait_for_requests
wait_for_requests
find_field
(
'issue
_
description'
).
send_keys
(
description_addition
)
find_field
(
'issue
-
description'
).
send_keys
(
description_addition
)
assert_template
(
template_content
+
description_addi
tion
)
assert_template
(
expected_content:
template_content
+
description_addition
,
page_part:
issue_form_loca
tion
)
select_option
'Reset template'
select_option
'Reset template'
assert_template
assert_template
(
page_part:
issue_form_location
)
save_changes
save_changes
end
end
it
'updates height of markdown textarea'
do
start_height
=
page
.
evaluate_script
(
'$(".markdown-area").outerHeight()'
)
select_template
'test'
wait_for_requests
end_height
=
page
.
evaluate_script
(
'$(".markdown-area").outerHeight()'
)
expect
(
end_height
).
not_to
eq
(
start_height
)
end
end
end
context
'user creates an issue using templates, with a prior description'
do
context
'user creates an issue using templates, with a prior description'
do
...
@@ -81,15 +74,18 @@ feature 'issuable templates', js: true do
...
@@ -81,15 +74,18 @@ feature 'issuable templates', js: true do
template_content
,
template_content
,
message:
'added issue template'
,
message:
'added issue template'
,
branch_name:
'master'
)
branch_name:
'master'
)
visit
edit_project_issue_path
project
,
issue
visit
project_issue_path
project
,
issue
fill_in
:'issue[title]'
,
with:
'test issue title'
page
.
within
(
'.content .issuable-actions'
)
do
fill_in
:'issue[description]'
,
with:
prior_description
click_on
'Edit'
end
fill_in
:'issue-title'
,
with:
'test issue title'
fill_in
:'issue-description'
,
with:
prior_description
end
end
scenario
'user selects "bug" template'
do
scenario
'user selects "bug" template'
do
select_template
'bug'
select_template
'bug'
wait_for_requests
wait_for_requests
assert_template
(
"
#{
template_content
}
"
)
assert_template
(
page_part:
issue_form_location
)
save_changes
save_changes
end
end
end
end
...
@@ -154,8 +150,10 @@ feature 'issuable templates', js: true do
...
@@ -154,8 +150,10 @@ feature 'issuable templates', js: true do
end
end
end
end
def
assert_template
(
expected_content
=
template_content
)
def
assert_template
(
expected_content:
template_content
,
page_part:
'#content-body'
)
expect
(
find
(
'textarea'
)[
'value'
]).
to
eq
(
expected_content
)
page
.
within
(
page_part
)
do
expect
(
find
(
'textarea'
)[
'value'
]).
to
eq
(
expected_content
)
end
end
end
def
save_changes
(
expected_content
=
template_content
)
def
save_changes
(
expected_content
=
template_content
)
...
...
spec/features/security/project/internal_access_spec.rb
View file @
7f69659a
...
@@ -181,21 +181,6 @@ describe "Internal Project Access" do
...
@@ -181,21 +181,6 @@ describe "Internal Project Access" do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
subject
{
project_snippets_path
(
project
)
}
...
...
spec/features/security/project/private_access_spec.rb
View file @
7f69659a
...
@@ -181,21 +181,6 @@ describe "Private Project Access" do
...
@@ -181,21 +181,6 @@ describe "Private Project Access" do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
subject
{
project_snippets_path
(
project
)
}
...
...
spec/features/security/project/public_access_spec.rb
View file @
7f69659a
...
@@ -394,21 +394,6 @@ describe "Public Project Access" do
...
@@ -394,21 +394,6 @@ describe "Public Project Access" do
it
{
is_expected
.
to
be_allowed_for
(
:visitor
)
}
it
{
is_expected
.
to
be_allowed_for
(
:visitor
)
}
end
end
describe
"GET /:project_path/issues/:id/edit"
do
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
subject
{
edit_project_issue_path
(
project
,
issue
)
}
it
{
is_expected
.
to
be_allowed_for
(
:admin
)
}
it
{
is_expected
.
to
be_allowed_for
(
:owner
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:master
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:developer
).
of
(
project
)
}
it
{
is_expected
.
to
be_allowed_for
(
:reporter
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
it
{
is_expected
.
to
be_denied_for
(
:user
)
}
it
{
is_expected
.
to
be_denied_for
(
:external
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
end
describe
"GET /:project_path/snippets"
do
describe
"GET /:project_path/snippets"
do
subject
{
project_snippets_path
(
project
)
}
subject
{
project_snippets_path
(
project
)
}
...
...
spec/support/update_invalid_issuable.rb
View file @
7f69659a
...
@@ -25,11 +25,13 @@ shared_examples 'update invalid issuable' do |klass|
...
@@ -25,11 +25,13 @@ shared_examples 'update invalid issuable' do |klass|
.
and_raise
(
ActiveRecord
::
StaleObjectError
.
new
(
issuable
,
:save
))
.
and_raise
(
ActiveRecord
::
StaleObjectError
.
new
(
issuable
,
:save
))
end
end
it
'renders edit when format is html'
do
if
klass
==
MergeRequest
put
:update
,
params
it
'renders edit when format is html'
do
put
:update
,
params
expect
(
response
).
to
render_template
(
:edit
)
expect
(
response
).
to
render_template
(
:edit
)
expect
(
assigns
[
:conflict
]).
to
be_truthy
expect
(
assigns
[
:conflict
]).
to
be_truthy
end
end
end
it
'renders json error message when format is json'
do
it
'renders json error message when format is json'
do
...
@@ -42,16 +44,17 @@ shared_examples 'update invalid issuable' do |klass|
...
@@ -42,16 +44,17 @@ shared_examples 'update invalid issuable' do |klass|
end
end
end
end
context
'when updating an invalid issuable'
do
if
klass
==
MergeRequest
before
do
context
'when updating an invalid issuable'
do
key
=
klass
==
Issue
?
:issue
:
:merge_request
before
do
params
[
key
][
:title
]
=
""
params
[
:merge_request
][
:title
]
=
""
end
end
it
'renders edit when merge request is invalid'
do
it
'renders edit when merge request is invalid'
do
put
:update
,
params
put
:update
,
params
expect
(
response
).
to
render_template
(
:edit
)
expect
(
response
).
to
render_template
(
:edit
)
end
end
end
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