diff --git a/src/spectator/formatting/failure_junit_test_case.cr b/src/spectator/formatting/failure_junit_test_case.cr index 1d0aced..894d94c 100644 --- a/src/spectator/formatting/failure_junit_test_case.cr +++ b/src/spectator/formatting/failure_junit_test_case.cr @@ -10,6 +10,11 @@ module Spectator::Formatting def initialize(@result : FailedResult) end + # Status string specific to the result type. + private def status + "FAIL" + end + # Adds the failed expectations to the XML block. private def content(xml) super diff --git a/src/spectator/formatting/junit_test_case.cr b/src/spectator/formatting/junit_test_case.cr index 80de989..c4b140e 100644 --- a/src/spectator/formatting/junit_test_case.cr +++ b/src/spectator/formatting/junit_test_case.cr @@ -12,7 +12,7 @@ module Spectator::Formatting private def attributes { name: result.example, - status: result, + status: status, classname: classname, } end @@ -20,6 +20,9 @@ module Spectator::Formatting # Result to pull values from. private abstract def result + # Status string specific to the result type. + private abstract def status : String + # Adds additional content to the "testcase" XML block. # Override this to add more content. private def content(xml) diff --git a/src/spectator/formatting/skipped_junit_test_case.cr b/src/spectator/formatting/skipped_junit_test_case.cr index 2ec0c01..3b6ed56 100644 --- a/src/spectator/formatting/skipped_junit_test_case.cr +++ b/src/spectator/formatting/skipped_junit_test_case.cr @@ -10,6 +10,11 @@ module Spectator::Formatting def initialize(@result : PendingResult) end + # Status string specific to the result type. + private def status + "TODO" + end + # Adds the skipped tag to the XML block. private def content(xml) super diff --git a/src/spectator/formatting/successful_junit_test_case.cr b/src/spectator/formatting/successful_junit_test_case.cr index f8f0227..b45bc87 100644 --- a/src/spectator/formatting/successful_junit_test_case.cr +++ b/src/spectator/formatting/successful_junit_test_case.cr @@ -7,5 +7,10 @@ module Spectator::Formatting # Creates the JUnit test case. def initialize(@result : SuccessfulResult) end + + # Status string specific to the result type. + private def status + "PASS" + end end end