diff --git a/app/models/form/sales/questions/discount.rb b/app/models/form/sales/questions/discount.rb new file mode 100644 index 000000000..4172ba4f2 --- /dev/null +++ b/app/models/form/sales/questions/discount.rb @@ -0,0 +1,17 @@ +class Form::Sales::Questions::Discount < ::Form::Question + def initialize(id, hsh, page) + super + @id = "discount" + @check_answer_label = "Percentage discount" + @header = "What was the percentage discount?" + @type = "numeric" + @page = page + @min = 0 + @max = 100 + @width = 5 + @suffix = "%" + @hint_text = "For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB) + If discount capped, enter capped % + If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given." + end +end diff --git a/app/models/form/sales/questions/equity.rb b/app/models/form/sales/questions/equity.rb new file mode 100644 index 000000000..585a14c36 --- /dev/null +++ b/app/models/form/sales/questions/equity.rb @@ -0,0 +1,15 @@ +class Form::Sales::Questions::Equity < ::Form::Question + def initialize(id, hsh, page) + super + @id = "equity" + @check_answer_label = "Initial percentage equity stake" + @header = "What was the initial percentage equity stake purchased?" + @type = "numeric" + @page = page + @min = 0 + @max = 100 + @width = 5 + @suffix = "%" + @hint_text = "Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)" + end +end diff --git a/app/models/form/sales/questions/grant.rb b/app/models/form/sales/questions/grant.rb new file mode 100644 index 000000000..edab388ac --- /dev/null +++ b/app/models/form/sales/questions/grant.rb @@ -0,0 +1,14 @@ +class Form::Sales::Questions::Grant < ::Form::Question + def initialize(id, hsh, page) + super + @id = "grant" + @check_answer_label = "Amount of any loan, grant or subsidy" + @header = "What was the amount of any loan, grant, discount or subsidy given?" + @type = "numeric" + @page = page + @min = 0 + @width = 5 + @prefix = "£" + @hint_text = "For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)" + end +end diff --git a/app/models/form/sales/questions/value.rb b/app/models/form/sales/questions/value.rb new file mode 100644 index 000000000..0686d6610 --- /dev/null +++ b/app/models/form/sales/questions/value.rb @@ -0,0 +1,14 @@ +class Form::Sales::Questions::Value < ::Form::Question + def initialize(id, hsh, page) + super + @id = "value" + @check_answer_label = "Full purchase price" + @header = "What was the full purchase price?" + @type = "numeric" + @page = page + @min = 0 + @width = 5 + @prefix = "£" + @hint_text = "Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)" + end +end diff --git a/spec/models/form/sales/questions/discount_spec.rb b/spec/models/form/sales/questions/discount_spec.rb new file mode 100644 index 000000000..977585d7b --- /dev/null +++ b/spec/models/form/sales/questions/discount_spec.rb @@ -0,0 +1,55 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Questions::Discount, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("discount") + end + + it "has the correct header" do + expect(question.header).to eq("What was the percentage discount?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Percentage discount") + end + + it "has the correct type" do + expect(question.type).to eq("numeric") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct hint" do + expect(question.hint_text).to eq("For Right to Buy (RTB), Preserved Right to Buy (PRTB), and Voluntary Right to Buy (VRTB) + If discount capped, enter capped % + If the property is being sold to an existing tenant under the RTB, PRTB, or VRTB schemes, enter the % discount from the full market value that is being given.") + end + + it "has correct width" do + expect(question.width).to eq(5) + end + + it "has correct suffix" do + expect(question.suffix).to eq("%") + end + + it "has correct min" do + expect(question.min).to eq(0) + end + + it "has correct max" do + expect(question.max).to eq(100) + end +end diff --git a/spec/models/form/sales/questions/equity_spec.rb b/spec/models/form/sales/questions/equity_spec.rb new file mode 100644 index 000000000..91308c745 --- /dev/null +++ b/spec/models/form/sales/questions/equity_spec.rb @@ -0,0 +1,53 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Questions::Equity, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("equity") + end + + it "has the correct header" do + expect(question.header).to eq("What was the initial percentage equity stake purchased?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Initial percentage equity stake") + end + + it "has the correct type" do + expect(question.type).to eq("numeric") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct hint" do + expect(question.hint_text).to eq("Enter the amount of initial equity held by the purchaser (for example, 25% or 50%)") + end + + it "has correct width" do + expect(question.width).to eq(5) + end + + it "has correct suffix" do + expect(question.suffix).to eq("%") + end + + it "has correct min" do + expect(question.min).to eq(0) + end + + it "has correct max" do + expect(question.max).to eq(100) + end +end diff --git a/spec/models/form/sales/questions/grant_spec.rb b/spec/models/form/sales/questions/grant_spec.rb new file mode 100644 index 000000000..d4e92f703 --- /dev/null +++ b/spec/models/form/sales/questions/grant_spec.rb @@ -0,0 +1,49 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Questions::Grant, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("grant") + end + + it "has the correct header" do + expect(question.header).to eq("What was the amount of any loan, grant, discount or subsidy given?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Amount of any loan, grant or subsidy") + end + + it "has the correct type" do + expect(question.type).to eq("numeric") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct hint" do + expect(question.hint_text).to eq("For all schemes except Right to Buy (RTB), Preserved Right to Buy (PRTB), Voluntary Right to Buy (VRTB)") + end + + it "has correct width" do + expect(question.width).to eq(5) + end + + it "has correct prefix" do + expect(question.prefix).to eq("£") + end + + it "has correct min" do + expect(question.min).to eq(0) + end +end diff --git a/spec/models/form/sales/questions/value_spec.rb b/spec/models/form/sales/questions/value_spec.rb new file mode 100644 index 000000000..f9da45db0 --- /dev/null +++ b/spec/models/form/sales/questions/value_spec.rb @@ -0,0 +1,49 @@ +require "rails_helper" + +RSpec.describe Form::Sales::Questions::Value, type: :model do + subject(:question) { described_class.new(question_id, question_definition, page) } + + let(:question_id) { nil } + let(:question_definition) { nil } + let(:page) { instance_double(Form::Page) } + + it "has correct page" do + expect(question.page).to eq(page) + end + + it "has the correct id" do + expect(question.id).to eq("value") + end + + it "has the correct header" do + expect(question.header).to eq("What was the full purchase price?") + end + + it "has the correct check_answer_label" do + expect(question.check_answer_label).to eq("Full purchase price") + end + + it "has the correct type" do + expect(question.type).to eq("numeric") + end + + it "is not marked as derived" do + expect(question.derived?).to be false + end + + it "has the correct hint" do + expect(question.hint_text).to eq("Enter the full purchase price of the property before any discounts are applied. For shared ownership, enter the full purchase price paid for 100% equity (this is equal to the value of the share owned by the PRP plus the value bought by the purchaser)") + end + + it "has correct width" do + expect(question.width).to eq(5) + end + + it "has correct prefix" do + expect(question.prefix).to eq("£") + end + + it "has correct min" do + expect(question.min).to eq(0) + end +end