|
|
@ -182,39 +182,39 @@ RSpec.describe Form, type: :model do |
|
|
|
|
|
|
|
|
|
|
|
it "Must be completed and between 2 and 99 if type of tenancy is Assured shorthold" do |
|
|
|
it "Must be completed and between 2 and 99 if type of tenancy is Assured shorthold" do |
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Assured Shorthold Tenancy (AST)", |
|
|
|
CaseLog.create!(tenancy: "Assured Shorthold", |
|
|
|
tenancylength: 1) |
|
|
|
tenancylength: 1) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Assured Shorthold Tenancy (AST)", |
|
|
|
CaseLog.create!(tenancy: "Assured Shorthold", |
|
|
|
tenancylength: nil) |
|
|
|
tenancylength: nil) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Assured Shorthold Tenancy (AST)", |
|
|
|
CaseLog.create!(tenancy: "Assured Shorthold", |
|
|
|
tenancylength: 2) |
|
|
|
tenancylength: 2) |
|
|
|
}.not_to raise_error |
|
|
|
}.not_to raise_error |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "Must be empty or between 2 and 99 if type of tenancy is Secure" do |
|
|
|
it "Must be empty or between 2 and 99 if type of tenancy is Secure" do |
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancylength: 1) |
|
|
|
tenancylength: 1) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancylength: 100) |
|
|
|
tenancylength: 100) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancylength: nil) |
|
|
|
tenancylength: nil) |
|
|
|
}.not_to raise_error |
|
|
|
}.not_to raise_error |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancylength: 2) |
|
|
|
tenancylength: 2) |
|
|
|
}.not_to raise_error |
|
|
|
}.not_to raise_error |
|
|
|
end |
|
|
|
end |
|
|
@ -294,12 +294,12 @@ RSpec.describe Form, type: :model do |
|
|
|
|
|
|
|
|
|
|
|
it "must not be provided if tenancy type is not other" do |
|
|
|
it "must not be provided if tenancy type is not other" do |
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancyother: "the other reason provided") |
|
|
|
tenancyother: "the other reason provided") |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
}.to raise_error(ActiveRecord::RecordInvalid) |
|
|
|
|
|
|
|
|
|
|
|
expect { |
|
|
|
expect { |
|
|
|
CaseLog.create!(tenancy: "Fixed term – Secure", |
|
|
|
CaseLog.create!(tenancy: "Secure (including flexible)", |
|
|
|
tenancyother: nil) |
|
|
|
tenancyother: nil) |
|
|
|
}.not_to raise_error |
|
|
|
}.not_to raise_error |
|
|
|
end |
|
|
|
end |
|
|
|