Remove unused format.js versions#create

pull/4850/head
Oliver Günther 8 years ago
parent 02e2774cde
commit 57a4539ddb
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 18
      app/controllers/versions_controller.rb
  2. 30
      spec/controllers/versions_controller_spec.rb

@ -85,22 +85,10 @@ class VersionsController < ApplicationController
if request.post?
if @version.save
respond_to do |format|
format.html do
flash[:notice] = l(:notice_successful_create)
redirect_to controller: '/projects', action: 'settings', tab: 'versions', id: @project
end
format.js do
render locals: { versions: @project.shared_versions.open, version: @version }
end
end
flash[:notice] = l(:notice_successful_create)
redirect_to controller: '/projects', action: 'settings', tab: 'versions', id: @project
else
respond_to do |format|
format.html do render action: 'new' end
format.js do
render(:update) { |page| page.alert(@version.errors.full_messages.join('\n')) }
end
end
format.html do render action: 'new' end
end
end
end

@ -153,36 +153,6 @@ describe VersionsController, type: :controller do
expect(version.project).to eq(project)
end
end
context 'from issue form' do
render_views
before do
login_as(user)
post :create, project_id: project.id, version: { name: 'test_add_version_from_issue_form' }, format: :js
end
it 'generates the new version' do
version = Version.find_by(name: 'test_add_version_from_issue_form')
expect(version).not_to be_nil
expect(version.project).to eq(project)
end
it 'returns updated select box with new version' do
version = Version.find_by(name: 'test_add_version_from_issue_form')
expect(response.body).to include(
"option selected=\\\"selected\\\" value=\\\"#{version.id}\\\""
)
end
it 'escapes potentially harmful html' do
harmful = "test <script>alert('pwned');</script>"
post :create, project_id: project.id, version: { name: harmful }, format: :js
expect(response.body).not_to include("<script>alert('pwned');</script>")
end
end
end
describe '#edit' do

Loading…
Cancel
Save