Skip to content

Commit

Permalink
Fix error when refusing a question (fixes #1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
waj committed Jun 28, 2017
1 parent 1581a5e commit d5915fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ask/runtime/flow.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/lib/runtime/flow_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d5915fe

Please sign in to comment.