Browse Source

fix various tests

validations-copy
Arthur Campbell 2 years ago
parent
commit
a0a23be834
  1. 12
      spec/fixtures/forms/2021_2022.json
  2. 2
      spec/models/form/sales/questions/savings_spec.rb
  3. 4
      spec/models/sales_log_spec.rb
  4. 2
      spec/models/validations/shared_validations_spec.rb

12
spec/fixtures/forms/2021_2022.json vendored

@ -905,7 +905,7 @@
"hint_text": "Eligible for housing benefit or Universal Credit", "hint_text": "Eligible for housing benefit or Universal Credit",
"type": "numeric", "type": "numeric",
"min": 0, "min": 0,
"step": 1, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": [
"brent", "brent",
@ -921,7 +921,7 @@
"hint_text": "Eligible for housing benefit or Universal Credit", "hint_text": "Eligible for housing benefit or Universal Credit",
"type": "numeric", "type": "numeric",
"min": 0, "min": 0,
"step": 1, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": [
"brent", "brent",
@ -937,7 +937,7 @@
"hint_text": "Not eligible for housing benefit or Universal Credit. For example, hot water excluding water rates.", "hint_text": "Not eligible for housing benefit or Universal Credit. For example, hot water excluding water rates.",
"type": "numeric", "type": "numeric",
"min": 0, "min": 0,
"step": 1, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": [
"brent", "brent",
@ -954,7 +954,7 @@
"type": "numeric", "type": "numeric",
"min": 0, "min": 0,
"max": 300, "max": 300,
"step": 1, "step": 0.01,
"width": 4, "width": 4,
"fields-to-add": [ "fields-to-add": [
"brent", "brent",
@ -970,7 +970,7 @@
"hint_text": "This is the total of rent and all charges", "hint_text": "This is the total of rent and all charges",
"type": "numeric_output", "type": "numeric_output",
"min": 0, "min": 0,
"step": 1, "step": 0.01,
"width": 4, "width": 4,
"readonly": true, "readonly": true,
"requires_js": true "requires_js": true
@ -987,7 +987,7 @@
"hint_text": "", "hint_text": "",
"type": "numeric", "type": "numeric",
"min": 0, "min": 0,
"step": "1", "step": 1,
"width": 5, "width": 5,
"prefix": "£", "prefix": "£",
"suffix": " every week" "suffix": " every week"

2
spec/models/form/sales/questions/savings_spec.rb

@ -40,7 +40,7 @@ RSpec.describe Form::Sales::Questions::Savings, type: :model do
end end
it "has correct step" do it "has correct step" do
expect(question.step).to eq(1) expect(question.step).to be 10
end end
it "has correct prefix" do it "has correct prefix" do

4
spec/models/sales_log_spec.rb

@ -506,9 +506,9 @@ RSpec.describe SalesLog, type: :model do
let(:completed_sales_log) { create(:sales_log, :completed) } let(:completed_sales_log) { create(:sales_log, :completed) }
it "returns small numbers correctly formatted as currency" do it "returns small numbers correctly formatted as currency" do
completed_sales_log.update!(savings: 4) completed_sales_log.update!(savings: 20)
expect(completed_sales_log.field_formatted_as_currency("savings")).to eq("£4.00") expect(completed_sales_log.field_formatted_as_currency("savings")).to eq("£20.00")
end end
it "returns quite large numbers correctly formatted as currency" do it "returns quite large numbers correctly formatted as currency" do

2
spec/models/validations/shared_validations_spec.rb

@ -105,7 +105,7 @@ RSpec.describe Validations::SharedValidations do
end end
context "when validating price" do context "when validating price" do
it "validates that £ prefix and , is added in the error message" do it "validates that prefix £ and delimeter ',' is added in the error message" do
sales_log.income1 = -5 sales_log.income1 = -5
shared_validator.validate_numeric_min_max(sales_log) shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["income1"]) expect(sales_log.errors["income1"])

Loading…
Cancel
Save