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 deleted file mode 100644 index 5ec7f5101b1..00000000000 --- a/lib/smart_answer_flows/locales/en/part-year-profit-tax-credits.yml +++ /dev/null @@ -1,50 +0,0 @@ -en-GB: - flow: - part-year-profit-tax-credits: - when_did_your_tax_credits_award_end?: - title: When did your Tax Credits award end? - hint: You can find this on your award review. - error_message: You need to enter a date to continue. - have_you_stopped_trading?: - 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: - This date must be between %{tax_year_begins_on} and %{tax_year_ends_on}, - which is the start and end dates of the tax year that your tax credit award ends in. - not_in_tax_year_error: The date must be between %{tax_year_begins_on} and %{tax_year_ends_on}. - error_message: You need to enter a date to continue. - what_date_do_your_accounts_go_up_to?: - title: What date do your accounts go up to? - hint: This is the last date of the accounting period for your business. For most people, this will be 5 April. - error_message: You need to enter a date to continue. - 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: - This date must be before %{award_period_ends_on}. - error_message: You need to enter a date to continue. - invalid_start_trading_date: - The start trading date must be before the date your Tax Credits award ends. - what_is_your_taxable_profit?: - title: What is your actual or estimated taxable profit between %{basis_period_begins_on} and %{basis_period_ends_on}? - hint: - This is the amount left over after you take all your earnings from self-employment and deduct any allowable expenses and losses. - If this is over 2 years of accounts you need to add them together. - error_message: Enter your taxable profit. diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits.rb b/lib/smart_answer_flows/part-year-profit-tax-credits.rb index 2227794aa41..d0faeadf71a 100644 --- a/lib/smart_answer_flows/part-year-profit-tax-credits.rb +++ b/lib/smart_answer_flows/part-year-profit-tax-credits.rb @@ -7,6 +7,8 @@ def define satisfies_need "103438" content_id "de6723a5-7256-4bfd-aad3-82b04b06b73e" + use_erb_templates_for_questions + date_question :when_did_your_tax_credits_award_end? do from { Calculators::PartYearProfitTaxCreditsCalculator::TAX_CREDITS_AWARD_ENDS_EARLIEST_DATE } to { Calculators::PartYearProfitTaxCreditsCalculator::TAX_CREDITS_AWARD_ENDS_LATEST_DATE } diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/did_you_start_trading_before_the_relevant_accounting_year.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/did_you_start_trading_before_the_relevant_accounting_year.govspeak.erb new file mode 100644 index 00000000000..d7a3ece0e8c --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/did_you_start_trading_before_the_relevant_accounting_year.govspeak.erb @@ -0,0 +1,12 @@ +<% content_for :title do %> + Did you start trading before <%= format_date(accounting_year_begins_on) %>? +<% end %> + +<% options( + "yes": "Yes", + "no": "No" +) %> + +<% content_for :error_message do %> + You need to select yes or no to continue. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/do_your_accounts_cover_a_12_month_period.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/do_your_accounts_cover_a_12_month_period.govspeak.erb new file mode 100644 index 00000000000..3c5960367d3 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/do_your_accounts_cover_a_12_month_period.govspeak.erb @@ -0,0 +1,12 @@ +<% content_for :title do %> + Do your accounts cover the 12 month period up to <%= format_date(accounting_year_ends_on) %>? +<% end %> + +<% options( + "yes": "Yes", + "no": "No" +) %> + +<% content_for :error_message do %> + You need to select yes or no to continue. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/have_you_stopped_trading.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/have_you_stopped_trading.govspeak.erb new file mode 100644 index 00000000000..b9f4a85bf67 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/have_you_stopped_trading.govspeak.erb @@ -0,0 +1,16 @@ +<% content_for :title do %> + Have you stopped trading? +<% end %> + +<% options( + "yes": "Yes", + "no": "No" +) %> + +<% content_for :hint do %> + This means you’re no longer running your business. +<% end %> + +<% content_for :error_message do %> + You need to select yes or no to continue. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_date_do_your_accounts_go_up_to.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_date_do_your_accounts_go_up_to.govspeak.erb new file mode 100644 index 00000000000..d23cef350d2 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_date_do_your_accounts_go_up_to.govspeak.erb @@ -0,0 +1,11 @@ +<% content_for :title do %> + What date do your accounts go up to? +<% end %> + +<% content_for :hint do %> + This is the last date of the accounting period for your business. For most people, this will be 5 April. +<% end %> + +<% content_for :error_message do %> + You need to enter a date to continue. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_is_your_taxable_profit.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_is_your_taxable_profit.govspeak.erb new file mode 100644 index 00000000000..4882f6dbbf2 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/what_is_your_taxable_profit.govspeak.erb @@ -0,0 +1,11 @@ +<% content_for :title do %> + What is your actual or estimated taxable profit between <%= format_date(basis_period_begins_on) %> and <%= format_date(basis_period_ends_on) %>? +<% end %> + +<% content_for :hint do %> + This is the amount left over after you take all your earnings from self-employment and deduct any allowable expenses and losses. If this is over 2 years of accounts you need to add them together. +<% end %> + +<% content_for :error_message do %> + Enter your taxable profit. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_start_trading.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_start_trading.govspeak.erb new file mode 100644 index 00000000000..2c496ddf69e --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_start_trading.govspeak.erb @@ -0,0 +1,14 @@ +<% content_for :title do %> + When did you start trading? +<% end %> + +<% content_for :hint do %> + This date must be before <%= format_date(award_period_ends_on) %>. +<% end %> + +<% content_for :error_message do %> + You need to enter a date to continue. +<% end %> +<% content_for :invalid_start_trading_date do %> + The start trading date must be before the date your Tax Credits award ends. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_stop_trading.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_stop_trading.govspeak.erb new file mode 100644 index 00000000000..355057cf209 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_you_stop_trading.govspeak.erb @@ -0,0 +1,14 @@ +<% content_for :title do %> + When did you stop trading? +<% end %> + +<% content_for :hint do %> + This date must be between <%= format_date(tax_year_begins_on) %> and <%= format_date(tax_year_ends_on) %>, which is the start and end dates of the tax year that your tax credit award ends in. +<% end %> + +<% content_for :not_in_tax_year_error do %> + The date must be between <%= format_date(tax_year_begins_on) %> and <%= format_date(tax_year_ends_on) %>. +<% end %> +<% content_for :error_message do %> + You need to enter a date to continue. +<% end %> diff --git a/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_your_tax_credits_award_end.govspeak.erb b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_your_tax_credits_award_end.govspeak.erb new file mode 100644 index 00000000000..8e73455f9d1 --- /dev/null +++ b/lib/smart_answer_flows/part-year-profit-tax-credits/questions/when_did_your_tax_credits_award_end.govspeak.erb @@ -0,0 +1,11 @@ +<% content_for :title do %> + When did your Tax Credits award end? +<% end %> + +<% content_for :hint do %> + You can find this on your award review. +<% end %> + +<% content_for :error_message do %> + You need to enter a date to continue. +<% end %> 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 91a870840a2..0c1c07a6193 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 @@ -52,23 +52,6 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase end end - context 'when rendering did_you_start_trading_before_the_relevant_accounting_year? question' do - setup do - question = @flow.node(:did_you_start_trading_before_the_relevant_accounting_year?) - @state = SmartAnswer::State.new(question) - @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 - end - end - context 'when rendering do_your_accounts_cover_a_12_month_period? question' do setup do question = @flow.node(:do_your_accounts_cover_a_12_month_period?) @@ -115,15 +98,23 @@ class PartYearProfitTaxCreditsViewTest < ActiveSupport::TestCase context 'when rendering did_you_start_trading_before_the_relevant_accounting_year? question' do setup do question = @flow.node(:did_you_start_trading_before_the_relevant_accounting_year?) - state = SmartAnswer::State.new(question) - state.accounting_year_begins_on = Date.parse('2015-04-06') - presenter = QuestionPresenter.new(@i18n_prefix, question, state) - @title = presenter.title + @state = SmartAnswer::State.new(question) + @state.accounting_year_begins_on = Date.parse('2015-04-06') + @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 end should 'display title with interpolated accounting_year_begins_on' do expected = "Did you start trading before 6 April 2015?" - assert_equal expected, @title + assert_equal expected, @presenter.title end end