diff --git a/apps/dashboard/app/helpers/scripts_helper.rb b/apps/dashboard/app/helpers/scripts_helper.rb index f3477522a7..92879bf762 100644 --- a/apps/dashboard/app/helpers/scripts_helper.rb +++ b/apps/dashboard/app/helpers/scripts_helper.rb @@ -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 diff --git a/apps/dashboard/test/helpers/scripts_helper_test.rb b/apps/dashboard/test/helpers/scripts_helper_test.rb new file mode 100644 index 0000000000..79674300c2 --- /dev/null +++ b/apps/dashboard/test/helpers/scripts_helper_test.rb @@ -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