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.
25 lines
778 B
25 lines
778 B
3 years ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe FormPageErrorHelper do
|
||
|
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
|