|
|
|
@ -744,6 +744,35 @@ RSpec.describe FormController, type: :request do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with invalid multiple question answers" do |
|
|
|
|
let(:page) { Capybara::Node::Simple.new(response.body) } |
|
|
|
|
let(:page_id) { "rent" } |
|
|
|
|
let(:params) do |
|
|
|
|
{ |
|
|
|
|
id: lettings_log.id, |
|
|
|
|
lettings_log: { |
|
|
|
|
page: page_id, |
|
|
|
|
"period" => 10, |
|
|
|
|
"supcharg" => 1_000_000, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
allow(Rails.logger).to receive(:info) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "shows not answered and invalid answer errors at the same time" do |
|
|
|
|
post "/lettings-logs/#{lettings_log.id}/#{page_id.dasherize}", params: params |
|
|
|
|
follow_redirect! |
|
|
|
|
expect(page).to have_content("There is a problem") |
|
|
|
|
expect(page).to have_content("Support Charge must be between 0 and 300.") |
|
|
|
|
expect(page).to have_content("You must answer basic rent.") |
|
|
|
|
expect(page).to have_content("You must answer personal service charge.") |
|
|
|
|
expect(page).to have_content("You must answer service charge.") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "with invalid organisation answers" do |
|
|
|
|
let(:page) { Capybara::Node::Simple.new(response.body) } |
|
|
|
|
let(:managing_organisation) { create(:organisation) } |
|
|
|
|