|
|
|
@ -14,7 +14,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "tenancy length should not be present" do |
|
|
|
|
record.tenancy = "Other" |
|
|
|
|
record.tenancylength = 10 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to include(match(expected_error)) |
|
|
|
|
expect(record.errors["tenancy"]).to include(match(expected_error)) |
|
|
|
|
end |
|
|
|
@ -27,7 +27,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "adds an error" do |
|
|
|
|
record.tenancy = "Assured Shorthold" |
|
|
|
|
record.tenancylength = 1 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to include(match(expected_error)) |
|
|
|
|
expect(record.errors["tenancy"]).to include(match(expected_error)) |
|
|
|
|
end |
|
|
|
@ -37,7 +37,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "adds an error" do |
|
|
|
|
record.tenancy = "Assured Shorthold" |
|
|
|
|
record.tenancylength = 100 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to include(match(expected_error)) |
|
|
|
|
expect(record.errors["tenancy"]).to include(match(expected_error)) |
|
|
|
|
end |
|
|
|
@ -47,7 +47,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "does not add an error" do |
|
|
|
|
record.tenancy = "Assured Shorthold" |
|
|
|
|
record.tenancylength = 3 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to be_empty |
|
|
|
|
expect(record.errors["tenancy"]).to be_empty |
|
|
|
|
end |
|
|
|
@ -57,7 +57,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "does not add an error" do |
|
|
|
|
record.tenancy = "Assured Shorthold" |
|
|
|
|
record.tenancylength = nil |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to be_empty |
|
|
|
|
expect(record.errors["tenancy"]).to be_empty |
|
|
|
|
end |
|
|
|
@ -71,7 +71,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "adds an error" do |
|
|
|
|
record.tenancy = "Secure (including flexible)" |
|
|
|
|
record.tenancylength = 1 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to include(match(expected_error)) |
|
|
|
|
expect(record.errors["tenancy"]).to include(match(expected_error)) |
|
|
|
|
end |
|
|
|
@ -81,7 +81,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "adds an error" do |
|
|
|
|
record.tenancy = "Secure (including flexible)" |
|
|
|
|
record.tenancylength = 100 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to include(match(expected_error)) |
|
|
|
|
expect(record.errors["tenancy"]).to include(match(expected_error)) |
|
|
|
|
end |
|
|
|
@ -91,7 +91,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "does not add an error" do |
|
|
|
|
record.tenancy = "Secure (including flexible)" |
|
|
|
|
record.tenancylength = 3 |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to be_empty |
|
|
|
|
expect(record.errors["tenancy"]).to be_empty |
|
|
|
|
end |
|
|
|
@ -101,7 +101,7 @@ RSpec.describe Validations::TenancyValidations do
|
|
|
|
|
it "does not add an error" do |
|
|
|
|
record.tenancy = "Secure (including flexible)" |
|
|
|
|
record.tenancylength = nil |
|
|
|
|
subject.validate_fixed_term_tenancy(record) |
|
|
|
|
tenancy_validator.validate_fixed_term_tenancy(record) |
|
|
|
|
expect(record.errors["tenancylength"]).to be_empty |
|
|
|
|
expect(record.errors["tenancy"]).to be_empty |
|
|
|
|
end |
|
|
|
|