diff --git a/app/models/automate_workspace.rb b/app/models/automate_workspace.rb index 096eb16ed2e..7a8e912056a 100644 --- a/app/models/automate_workspace.rb +++ b/app/models/automate_workspace.rb @@ -6,8 +6,8 @@ class AutomateWorkspace < ApplicationRecord validates :user, :presence => true def merge_output!(hash) - if hash['workspace'].nil? || hash['state_vars'].nil? - raise ArgumentError, "No workspace or state_vars specified for edit" + if hash['objects'].nil? || hash['state_vars'].nil? + raise ArgumentError, "No objects or state_vars specified for edit" end self[:output] = (output || {}).deep_merge(hash) diff --git a/spec/models/automate_workspace_spec.rb b/spec/models/automate_workspace_spec.rb index 85f072c82ec..9982def9205 100644 --- a/spec/models/automate_workspace_spec.rb +++ b/spec/models/automate_workspace_spec.rb @@ -7,9 +7,9 @@ end it "properly merges the hash with the new output" do - hash = {'workspace' => {'a' => 1}, 'state_vars' => {'b' => 2}} - partial_hash = {'workspace' => {'c' => 1}, 'state_vars' => {} } - merged_hash = {'workspace' => {'a' => 1, 'c' => 1}, 'state_vars' => {'b' => 2}} + hash = {'objects' => {'root' => {'a' => 1}}, 'state_vars' => {'b' => 2}} + partial_hash = {'objects' => {'root' => {'c' => 1}}, 'state_vars' => {} } + merged_hash = {'objects' => {'root' => {'a' => 1, 'c' => 1}}, 'state_vars' => {'b' => 2}} aw.merge_output!(hash) aw.reload