From d5915feef8dabd09f7f8ad12d158cec250899c10 Mon Sep 17 00:00:00 2001 From: Juan Wajnerman Date: Wed, 28 Jun 2017 13:56:43 -0300 Subject: [PATCH] Fix error when refusing a question (fixes #1110) --- lib/ask/runtime/flow.ex | 2 +- test/lib/runtime/flow_test.exs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ask/runtime/flow.ex b/lib/ask/runtime/flow.ex index 317f7b96b..cbfb35c01 100644 --- a/lib/ask/runtime/flow.ex +++ b/lib/ask/runtime/flow.ex @@ -136,7 +136,7 @@ defmodule Ask.Runtime.Flow do flow = flow |> advance_current_step(step, reply_value, mode) {%{flow | retries: 0}, %Reply{}, visitor} {:refusal, reply_value} -> - advance_after_reply(flow, step, reply_value, visitor, mode, stores: "REFUSED") + advance_after_reply(flow, step, reply_value, visitor, mode, stores: %{step["store"] => "REFUSED"}) reply_value -> advance_after_reply(flow, step, reply_value, visitor, mode, stores: %{step["store"] => reply_value}) end diff --git a/test/lib/runtime/flow_test.exs b/test/lib/runtime/flow_test.exs index d3e96df6d..67334a553 100644 --- a/test/lib/runtime/flow_test.exs +++ b/test/lib/runtime/flow_test.exs @@ -442,7 +442,7 @@ defmodule Ask.FlowTest do |> Flow.step(@sms_visitor) result = flow |> Flow.step(@sms_visitor, Flow.Message.reply("skip")) - assert {:end, _, %{stores: "REFUSED"}} = result + assert {:end, _, %{stores: %{"Perfect Number" => "REFUSED"}}} = result end test "refusal is stronger than response" do @@ -480,7 +480,7 @@ defmodule Ask.FlowTest do result = flow |> Flow.step(@sms_visitor, Flow.Message.reply("1")) # No stores (because of refusal) - assert {:end, _, %{stores: "REFUSED"}} = result + assert {:end, _, %{stores: %{"Perfect Number" => "REFUSED"}}} = result end describe "numeric steps" do