mirror of
https://github.com/we-promise/sure.git
synced 2026-05-07 21:04:12 +00:00
feat(entries): Add amount validation and robustify monetizable concern (#1680)
* feat(entries): Add amount validation and robustify monetizable concern * fix(valuations): localize blank amount errors --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: SureBot <sure-bot@we-promise.com>
This commit is contained in:
@@ -50,4 +50,31 @@ class ValuationsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal 22000, @entry.amount
|
||||
assert_equal "Test notes", @entry.notes
|
||||
end
|
||||
|
||||
test "confirm_create with blank amount returns unprocessable entity" do
|
||||
account = accounts(:investment)
|
||||
|
||||
post confirm_create_valuations_url, params: {
|
||||
entry: {
|
||||
amount: "",
|
||||
date: Date.current.to_s,
|
||||
account_id: account.id
|
||||
}
|
||||
}
|
||||
|
||||
assert_response :unprocessable_entity
|
||||
assert_match I18n.t("valuations.errors.amount_required"), response.body
|
||||
end
|
||||
|
||||
test "confirm_update with blank amount returns unprocessable entity" do
|
||||
post confirm_update_valuation_url(@entry), params: {
|
||||
entry: {
|
||||
amount: "",
|
||||
date: Date.current.to_s
|
||||
}
|
||||
}
|
||||
|
||||
assert_response :unprocessable_entity
|
||||
assert_match I18n.t("valuations.errors.amount_required"), response.body
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user