Skip to content

Commit 896de5e

Browse files
David Rodríguezsds
David Rodríguez
authored andcommitted
Fix minitest pre-push hook
1 parent bbbbb3d commit 896de5e

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

config/default.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ PrePush:
813813
Minitest:
814814
enabled: false
815815
description: 'Running Minitest test suite'
816-
command: ['ruby', '-Ilib:test', 'test']
817-
required_library: 'minitest'
816+
command: ['ruby', '-Ilib:test', '-rminitest', "-e 'exit! Minitest.run'"]
817+
include: 'test/**/*_test.rb'
818818

819819
# Hooks that run during `git rebase`, before any commits are rebased.
820820
# If a hook fails, the rebase is aborted.

lib/overcommit/hook/pre_push/minitest.rb

+4
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,9 @@ def run
1010
output = result.stdout + result.stderr
1111
[:fail, output]
1212
end
13+
14+
def command
15+
super + included_files.map { |file| "-r#{file}" }
16+
end
1317
end
1418
end

spec/overcommit/hook/pre_push/minitest_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe Overcommit::Hook::PrePush::Minitest do
44
let(:config) { Overcommit::ConfigurationLoader.default_configuration }
5-
let(:context) { double('context') }
5+
let(:context) { double('context', all_files: ['test/test_foo.rb']) }
66
subject { described_class.new(config, context) }
77

88
context 'when minitest exits successfully' do

0 commit comments

Comments
 (0)