fix legacy spec

pull/5212/head
Wieland Lindenthal 8 years ago committed by Oliver Günther
parent 5e692a37a5
commit 92301259aa
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 2
      app/controllers/types_controller.rb
  2. 13
      spec_legacy/functional/types_controller_spec.rb

@ -62,7 +62,7 @@ class TypesController < ApplicationController
@type.workflows.copy(copy_from)
end
flash[:notice] = l(:notice_successful_create)
redirect_to action: 'index'
redirect_to action: 'edit', tab: 'settings'
else
@types = ::Type.order('position')
@projects = Project.all

@ -52,24 +52,17 @@ describe TypesController, type: :controller do
end
it 'should post create' do
post :create, type: {
post :create, tab: "settings", type: {
name: 'New type',
project_ids: ['1', '', ''],
attribute_visibility: {
custom_field_1: 'default',
custom_field_6: 'visible'
}
}
assert_redirected_to action: 'index'
assert_redirected_to action: 'edit', tab: 'settings'
type = ::Type.find_by(name: 'New type')
assert_equal [1], type.project_ids.sort
assert_equal [1, 6], type.custom_field_ids
assert_equal 0, type.workflows.count
end
it 'should post create with workflow copy' do
post :create, type: { name: 'New type' }, copy_workflow_from: 1
assert_redirected_to action: 'index'
assert_redirected_to action: 'edit', tab: 'settings'
type = ::Type.find_by(name: 'New type')
assert_equal 0, type.projects.count
assert_equal ::Type.find(1).workflows.count, type.workflows.count

Loading…
Cancel
Save