fix action IDs again AGAIN

This commit is contained in:
24c02 2025-12-09 21:15:25 -05:00
parent 81f4f9fab6
commit eb9dc771eb
4 changed files with 15 additions and 15 deletions

View file

@ -61,10 +61,10 @@ module OnboardingScenarios
when "flavortown_continue" then :kitchen_code
when "flavortown_agree" then :taste_test
when "flavortown_taste_correct" then { step: :promoted, promote: true }
when /\Aflavortown_taste_wrong_\d+\z/ then :taste_wrong
when /\Aflavortown_taste_wrong_[wt]\d+\z/ then :taste_wrong
when "flavortown_try_again" then :taste_test
when "flavortown_taste_wrong_again" then :taste_gave_up
when /\Aflavortown_taste_incredibly_wrong_\d+\z/ then :taste_terrible
when /\Aflavortown_taste_wrong_again_[wt]\d+\z/ then :taste_gave_up
when /\Aflavortown_taste_incredibly_wrong_[wt]\d+\z/ then :taste_terrible
when "flavortown_dino_nuggets" then :dino_nuggets
end
end

View file

@ -8,9 +8,9 @@ section <<~MSG, markdown: true
*What makes a dish truly great?*
MSG
wrong_answers = OnboardingScenarios::Flavortown::WRONG_ANSWERS.map.with_index { |(label, action, **opts), i| button(label, "#{action}_#{i}", **opts) }
terrible_answers = OnboardingScenarios::Flavortown::TERRIBLE_ANSWERS.map.with_index { |(label, action, **opts), i| button(label, "#{action}_#{i}", **opts) }
dino_nuggets = OnboardingScenarios::Flavortown::DINO_NUGGETS.then { |(label, action, **opts)| button(label, action, **opts) }
wrong_answers = OnboardingScenarios::Flavortown::WRONG_ANSWERS.map.with_index { |(label, action, opts), i| button(label, "#{action}_w#{i}", **opts) }
terrible_answers = OnboardingScenarios::Flavortown::TERRIBLE_ANSWERS.map.with_index { |(label, action, opts), i| button(label, "#{action}_t#{i}", **opts) }
dino_nuggets = OnboardingScenarios::Flavortown::DINO_NUGGETS.then { |(label, action, opts)| button(label, action, **opts) }
actions [
button("Love", "flavortown_taste_correct", style: "primary"),

View file

@ -10,8 +10,8 @@ section <<~MSG, markdown: true
*What makes a dish truly great?*
MSG
wrong_answers = OnboardingScenarios::Flavortown::WRONG_ANSWERS.map { |label, _, **opts| button(label, "flavortown_taste_wrong_again", **opts) }
terrible_answers = OnboardingScenarios::Flavortown::TERRIBLE_ANSWERS.map { |label, _, **opts| button(label, "flavortown_taste_wrong_again", **opts) }
wrong_answers = OnboardingScenarios::Flavortown::WRONG_ANSWERS.map.with_index { |(label, _, opts), i| button(label, "flavortown_taste_wrong_again_w#{i}", **opts) }
terrible_answers = OnboardingScenarios::Flavortown::TERRIBLE_ANSWERS.map.with_index { |(label, _, opts), i| button(label, "flavortown_taste_wrong_again_t#{i}", **opts) }
actions [
button("Love", "flavortown_taste_correct", style: "primary"),

View file

@ -60,7 +60,7 @@ RSpec.describe OnboardingScenarios::Flavortown do
context "wrong answers" do
it "goes to taste_wrong on first wrong answer" do
expect(scenario.handle_action("flavortown_taste_wrong")).to eq(:taste_wrong)
expect(scenario.handle_action("flavortown_taste_wrong_w0")).to eq(:taste_wrong)
end
it "allows retry from taste_wrong" do
@ -68,13 +68,13 @@ RSpec.describe OnboardingScenarios::Flavortown do
end
it "gives up after second wrong answer" do
expect(scenario.handle_action("flavortown_taste_wrong_again")).to eq(:taste_gave_up)
expect(scenario.handle_action("flavortown_taste_wrong_again_w0")).to eq(:taste_gave_up)
end
end
context "terrible answers" do
it "goes to taste_terrible on incredibly wrong answer" do
expect(scenario.handle_action("flavortown_taste_incredibly_wrong")).to eq(:taste_terrible)
expect(scenario.handle_action("flavortown_taste_incredibly_wrong_t0")).to eq(:taste_terrible)
end
it "goes to dino_nuggets on dino nuggets answer" do
@ -140,7 +140,7 @@ RSpec.describe OnboardingScenarios::Flavortown do
step = scenario.handle_action("flavortown_agree")
expect(step).to eq(:taste_test)
step = scenario.handle_action("flavortown_taste_wrong")
step = scenario.handle_action("flavortown_taste_wrong_w0")
expect(step).to eq(:taste_wrong)
step = scenario.handle_action("flavortown_try_again")
@ -154,10 +154,10 @@ RSpec.describe OnboardingScenarios::Flavortown do
scenario.handle_action("flavortown_continue")
scenario.handle_action("flavortown_agree")
step = scenario.handle_action("flavortown_taste_wrong")
step = scenario.handle_action("flavortown_taste_wrong_w0")
expect(step).to eq(:taste_wrong)
step = scenario.handle_action("flavortown_taste_wrong_again")
step = scenario.handle_action("flavortown_taste_wrong_again_w0")
expect(step).to eq(:taste_gave_up)
end
@ -176,7 +176,7 @@ RSpec.describe OnboardingScenarios::Flavortown do
scenario.handle_action("flavortown_continue")
scenario.handle_action("flavortown_agree")
step = scenario.handle_action("flavortown_taste_incredibly_wrong")
step = scenario.handle_action("flavortown_taste_incredibly_wrong_t0")
expect(step).to eq(:taste_terrible)
step = scenario.handle_action("flavortown_try_again")