lib/knapsack/adapters/minitest_adapter.rb in knapsack-2.0.0 vs lib/knapsack/adapters/minitest_adapter.rb in knapsack-3.0.0
- old
+ new
@@ -21,24 +21,24 @@
end
def bind_time_tracker
::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
- add_post_run_callback do
+ Minitest.after_run do
Knapsack.logger.info(Presenter.global_time)
end
end
def bind_report_generator
- add_post_run_callback do
+ Minitest.after_run do
Knapsack.report.save
Knapsack.logger.info(Presenter.report_details)
end
end
def bind_time_offset_warning
- add_post_run_callback do
+ Minitest.after_run do
Knapsack.logger.log(
Presenter.time_offset_log_level,
Presenter.time_offset_warning
)
end
@@ -61,19 +61,9 @@
full_test_path = method_object.source_location.first
parent_of_test_dir_regexp = Regexp.new("^#{@@parent_of_test_dir}")
test_path = full_test_path.gsub(parent_of_test_dir_regexp, '.')
# test_path will look like ./test/dir/unit_test.rb
test_path
- end
-
- private
-
- def add_post_run_callback(&block)
- if Minitest.respond_to?(:after_run)
- Minitest.after_run { block.call }
- else
- Minitest::Unit.after_tests { block.call }
- end
end
end
end
end