diff --git a/lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml b/lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml index d83074bd097..5ec7f5101b1 100644 --- a/lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml +++ b/lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml @@ -9,9 +9,15 @@ en-GB: title: Have you stopped trading? hint: This means you’re no longer running your business. error_message: You need to select yes or no to continue. + options: + "yes": "Yes" + "no": "No" did_you_start_trading_before_the_relevant_accounting_year?: title: Did you start trading before %{accounting_year_begins_on}? error_message: You need to select yes or no to continue. + options: + "yes": "Yes" + "no": "No" when_did_you_stop_trading?: title: When did you stop trading? hint: @@ -26,6 +32,9 @@ en-GB: do_your_accounts_cover_a_12_month_period?: title: Do your accounts cover the 12 month period up to %{accounting_year_ends_on}? error_message: You need to select yes or no to continue. + options: + "yes": "Yes" + "no": "No" when_did_you_start_trading?: title: "When did you start trading?" hint: diff --git a/test/unit/smart_answer_flows/part_year_profit_tax_credits_view_test.rb b/test/unit/smart_answer_flows/part_year_profit_tax_credits_view_test.rb index 251d02afaa5..c50cad86e0e 100644 --- a/test/unit/smart_answer_flows/part_year_profit_tax_credits_view_test.rb +++ b/test/unit/smart_answer_flows/part_year_profit_tax_credits_view_test.rb @@ -42,6 +42,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase @presenter = QuestionPresenter.new(@i18n_prefix, question, @state) end + should 'have options with labels' do + assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options)) + end + should 'have a default error message' do @state.error = 'error-message' assert_equal 'You need to select yes or no to continue.', @presenter.error @@ -55,6 +59,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase @presenter = QuestionPresenter.new(@i18n_prefix, question, @state) end + should 'have options with labels' do + assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options)) + end + should 'have a default error message' do @state.error = 'error-message' assert_equal 'You need to select yes or no to continue.', @presenter.error @@ -74,6 +82,10 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase assert_equal expected, @presenter.title end + should 'have options with labels' do + assert_equal({ 'yes' => 'Yes', 'no' => 'No' }, values_vs_labels(@presenter.options)) + end + should 'have a default error message' do @state.error = 'error-message' assert_equal 'You need to select yes or no to continue.', @presenter.error @@ -219,5 +231,11 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase end end end + + private + + def values_vs_labels(options) + options.inject({}) { |h,o| h[o.value] = o.label; h } + end end end