X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c00c515d9d12e25e63d3a0b3271862dd5b134ca4..f13f9473798a81113ac640612b878febd4afa714:/test/models/report_test.rb diff --git a/test/models/report_test.rb b/test/models/report_test.rb index a0de9448c..7b3b973b0 100644 --- a/test/models/report_test.rb +++ b/test/models/report_test.rb @@ -1,11 +1,40 @@ require "test_helper" class ReportTest < ActiveSupport::TestCase + def test_issue_required + report = create(:report) + + assert_predicate report, :valid? + report.issue = nil + assert_not_predicate report, :valid? + end + + def test_user_required + report = create(:report) + + assert_predicate report, :valid? + report.user = nil + assert_not_predicate report, :valid? + end + def test_details_required report = create(:report) - assert report.valid? - report.details = '' - assert !report.valid? + assert_predicate report, :valid? + report.details = "" + assert_not_predicate report, :valid? + end + + def test_category_required + report = create(:report) + + assert_predicate report, :valid? + report.category = "" + assert_not_predicate report, :valid? + end + + def test_details + report = create(:report) + assert_instance_of(RichText::Markdown, report.details) end end