From 57a4539ddbef8f5e4cbb0277ff6031f3686a1b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Mon, 5 Sep 2016 09:04:55 +0200 Subject: [PATCH] Remove unused format.js versions#create --- app/controllers/versions_controller.rb | 18 ++---------- spec/controllers/versions_controller_spec.rb | 30 -------------------- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb index 493711c548..993ac69296 100644 --- a/app/controllers/versions_controller.rb +++ b/app/controllers/versions_controller.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 diff --git a/spec/controllers/versions_controller_spec.rb b/spec/controllers/versions_controller_spec.rb index 13c5669b77..bddc45aa5d 100644 --- a/spec/controllers/versions_controller_spec.rb +++ b/spec/controllers/versions_controller_spec.rb @@ -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 " - post :create, project_id: project.id, version: { name: harmful }, format: :js - - expect(response.body).not_to include("") - end - end end describe '#edit' do