Skip to content

Commit

Permalink
Revert "fix multiple file metadata (#144)"
Browse files Browse the repository at this point in the history
This reverts commit 5280f9f.
  • Loading branch information
iHiD authored Mar 5, 2024
1 parent f99ad0e commit 216bca7
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/minitest_ext/exercism_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ def prerecord(*)
reset_user_output
end

def set_metadata(test_file, metadata)
@metadata[test_file] = metadata.each_with_object({}) do |md, hash|
def metadata=(metadata)
@metadata = metadata.each_with_object({}) do |md, hash|
hash[md[:test]] = md
end
end

def record(result)
test_metadata = metadata[result.source_location.first][result.name]
tests << TestResult.new(result, user_output, test_metadata)
tests << TestResult.new(result, user_output, metadata[result.name])
end

def report
Expand Down Expand Up @@ -65,7 +64,6 @@ def initialize(exercise, path)
@path = path
@tests = []
@report_written = false
@metadata = {}

reset_user_output
end
Expand Down
2 changes: 1 addition & 1 deletion lib/test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run
Minitest::PrideIO.pride!

Dir.glob("#{input_path}/*_test.rb").sort.each do |test_file|
reporter.set_metadata(test_file, ExtractMetadata.(test_file))
reporter.metadata = ExtractMetadata.(test_file)

begin
require test_file
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/metadata/expected_results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":2,"status":"fail","message":null,"tests":[{"name":"Skip works properly","test_code":"something = \"Something\"\nassert something.present?","status":"error","message":"NoMethodError: undefined method `present?' for \"Something\":String\n\nTraceback (most recent call first):\n Line 5:in `test_skip_works_properly'"},{"name":"Assert equal works properly","test_code":"some_result = TwoFer.two_fer\nassert_equal \"One for you, one for me.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 3:in `test_assert_equal_works_properly'"},{"name":"Zebra","test_code":"some_result = TwoFer.two_fer(\"zebra\")\nassert_equal \"One for you, one for zebra.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 3:in `test_zebra'"},{"name":"Anaconda","test_code":"some_result = TwoFer.two_fer(\"anaconda\")\nassert_equal \"One for you, one for anaconda.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 8:in `test_anaconda'"},{"name":"Gorilla","test_code":"some_result = TwoFer.two_fer(\"gorilla\")\nassert_equal \"One for you, one for gorilla.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 13:in `test_gorilla'"},{"name":"Boa","test_code":"some_result = TwoFer.two_fer(\"boa\")\nassert_equal \"One for you, one for boa.\", some_result","status":"error","message":"NameError: uninitialized constant SomeTest::TwoFer\n\nTraceback (most recent call first):\n Line 18:in `test_boa'"}]}
{"version":2,"status":"pass","message":null,"tests":[]}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 216bca7

Please sign in to comment.