File tree Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,14 @@ default_tasks = []
7
7
8
8
desc 'Run Unit Tests'
9
9
task :test do
10
- sh 'git config --global user.email "git@example.com"' if `git config user.email` . empty?
11
- sh 'git config --global user.name "GitExample"' if `git config user.name` . empty?
10
+ sh 'bin/test'
12
11
13
- $LOAD_PATH. unshift ( File . join ( __dir__ , 'tests' ) )
14
-
15
- Dir . glob ( File . join ( __dir__ , 'tests/**/test_*.rb' ) ) do |p |
16
- require p
17
- end
18
-
19
- # You can run individual test files from the command line with:
12
+ # You can run individual test files (or multiple files) from the command
13
+ # line with:
14
+ #
15
+ # $ bin/test tests/units/test_archive.rb
20
16
#
21
- # $ ruby -Ilib: tests tests/units/test_archive .rb
17
+ # $ bin/test tests/units/test_archive.rb tests/units/test_object .rb
22
18
end
23
19
default_tasks << :test
24
20
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+
6
+ `git config --global user.email "git@example.com"` if `git config user.email` . empty?
7
+ `git config --global user.name "GitExample"` if `git config user.name` . empty?
8
+
9
+ project_root = File . expand_path ( File . join ( __dir__ , '..' ) )
10
+
11
+ $LOAD_PATH. unshift ( File . join ( project_root , 'tests' ) )
12
+
13
+ if ARGV . empty?
14
+ paths = Dir . glob ( File . join ( project_root , 'tests/**/test_*.rb' ) )
15
+ else
16
+ paths = ARGV . map { |p | File . join ( project_root , p ) }
17
+ end
18
+
19
+ paths . each { |p | require p }
You can’t perform that action at this time.
0 commit comments