Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def perform
end

def draft_template_failure
ServiceResult.failure(message: I18n.t("recurring_meeting.occurrence.error_template_draft"))
recurring_meeting.errors.add(:base, I18n.t("recurring_meeting.occurrence.error_template_draft"))
ServiceResult.failure(errors: recurring_meeting.errors)
end

def validate_contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
expect(created_meeting).to be_nil
end

it "carries a non-empty errors object usable by the API layer" do
# Regression test: draft_template_failure used to return only a
# message with no errors:, which crashed
# API::Errors::ErrorBase.create_and_merge_errors(call.errors) with an
# ArgumentError ("expected at least one error") when the API route
# tried to build a MultipleErrors response from an empty error list.
expect(service_result.errors).not_to be_empty
end

it "does not add an occurrence" do
expect { instance.call(**params) }
.not_to change { series.meetings.not_templated.count }
Expand Down
Loading