Skip to content

Commit

Permalink
Merge pull request #18469 from eclarizio/BZ1670327
Browse files Browse the repository at this point in the history
Fix for inability to see dialog details passed to catalog after upgrade from 5.9.4 to 5.9.6
  • Loading branch information
jrafanie authored Mar 8, 2019
2 parents 297f4c2 + 142c158 commit 16dabe5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/models/dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ def initialize_value_context(_values)
end

def init_fields_with_values_for_request(values)
values = values.with_indifferent_access

dialog_field_hash.each do |_key, field|
field.value = values[field.automate_key_name] || values[field.name]
end
Expand Down
40 changes: 30 additions & 10 deletions spec/models/dialog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -520,19 +520,39 @@
let(:dialog_group) { DialogGroup.new(:dialog_fields => [dialog_field1]) }
let(:dialog_field1) { DialogField.new(:value => "123", :name => "field1") }

context "when the values use the automate key name" do
it "initializes the fields with the given values" do
values = {"dialog_field1" => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
context "when the keys are strings" do
context "when the values use the automate key name" do
it "initializes the fields with the given values" do
values = {"dialog_field1" => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
end
end

context "when the values use the regular name" do
it "initializes the fields with the given values" do
values = {"field1" => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
end
end
end

context "when the values use the regular name" do
it "initializes the fields with the given values" do
values = {"field1" => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
context "when the keys are symbols" do
context "when the values use the automate key name" do
it "initializes the fields with the given values" do
values = {:dialog_field1 => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
end
end

context "when the values use the regular name" do
it "initializes the fields with the given values" do
values = {:field1 => "field 1 new value"}
dialog.init_fields_with_values_for_request(values)
expect(dialog_field1.value).to eq("field 1 new value")
end
end
end
end
Expand Down

0 comments on commit 16dabe5

Please sign in to comment.