You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
871 B
30 lines
871 B
3 years ago
|
require "rails_helper"
|
||
3 years ago
|
require_relative "../request_helper"
|
||
3 years ago
|
|
||
|
RSpec.describe FormPageErrorHelper do
|
||
3 years ago
|
before do
|
||
|
RequestHelper.stub_http_requests
|
||
|
end
|
||
|
|
||
3 years ago
|
describe "#remove_other_page_errors" do
|
||
3 years ago
|
context "when non base other questions are removed" do
|
||
3 years ago
|
let!(:case_log) { FactoryBot.create(:case_log, :in_progress) }
|
||
|
let!(:form) { case_log.form }
|
||
|
|
||
|
before do
|
||
|
case_log.errors.add :layear, "error"
|
||
|
case_log.errors.add :period, "error_one"
|
||
|
case_log.errors.add :base, "error_too"
|
||
|
end
|
||
|
|
||
|
it "returns details and user tabs" do
|
||
|
page = form.get_page("rent")
|
||
|
remove_other_page_errors(case_log, page)
|
||
|
expect(case_log.errors.count).to eq(2)
|
||
|
expect(case_log.errors.map(&:attribute)).to include(:period)
|
||
|
expect(case_log.errors.map(&:attribute)).to include(:base)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|