6772312ea7
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later with some specific files to be licensed under the one of two licenses: CC0-1.0 LGPL-3.0-or-later This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
27 lines
874 B
Ruby
27 lines
874 B
Ruby
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
module Expect
|
|
|
|
def expect_validation_errors(list_of_errors, validators, error_validator_length_should_match=true)
|
|
if (list_of_errors.is_a?(ParamValidation::ValidationError))
|
|
|
|
list_of_errors = list_of_errors.data
|
|
end
|
|
if (list_of_errors.is_a?(Hash))
|
|
list_of_errors = [list_of_errors]
|
|
end
|
|
if (validators.is_a?(Hash))
|
|
validators = [validators]
|
|
end
|
|
if (error_validator_length_should_match)
|
|
expect(list_of_errors.length).to eq(validators.length)
|
|
end
|
|
|
|
validators.each{|i|
|
|
expect(list_of_errors.any?{|e| e[:key].to_s == i[:key].to_s && e[:name].to_s == i[:name].to_s}).to eq(true), "#{i[:key]} should have existed for #{i[:name]}"
|
|
}
|
|
end
|
|
|
|
def expect_email_queued
|
|
expect(EmailJobQueue).to receive(:queue)
|
|
end
|
|
end
|