Skip to content

Commit

Permalink
Disabled deleting auto_batch_clusters from edit script forms (#3100)
Browse files Browse the repository at this point in the history
* Disabled deleting auto_batch_clusters from edit script forms

* Updated to array.exclude? to avoid using negation
  • Loading branch information
abujeda authored Oct 4, 2023
1 parent 5a417a1 commit 479058f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/dashboard/app/helpers/scripts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def script_form_double
end

def script_removable_field?(id)
!['script_auto_scripts'].include?(id.to_s)
['script_auto_scripts', 'script_auto_batch_clusters'].exclude?(id.to_s)
end
end
14 changes: 14 additions & 0 deletions apps/dashboard/test/helpers/scripts_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'test_helper'

class ScriptsHelperTest < ActionView::TestCase
include ScriptsHelper

test 'script_removable_field? should return false for expected fields' do
assert_equal true, script_removable_field?('any_field')

non_removable_fields = ['script_auto_scripts', 'script_auto_batch_clusters']
non_removable_fields.each do |field|
assert_equal false, script_removable_field?(field)
end
end
end

0 comments on commit 479058f

Please sign in to comment.