File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -9,19 +9,19 @@ require 'xspec'
9
9
$LOAD_PATH. unshift "spec"
10
10
$LOAD_PATH. unshift "lib"
11
11
12
- filter = //
12
+ filter = nil
13
13
short_ids = [ ]
14
14
15
15
parser = OptionParser . new
16
16
parser . banner = "Usage: xspec [options] [files]"
17
17
parser . separator ""
18
- parser . on ( '-e FILTER' , "Only run specs with full name including FILTER" ) do |f |
18
+ parser . on ( '-e FILTER' , "Run specs with full name including FILTER. " ) do |f |
19
19
filter = Regexp . new ( f )
20
20
end
21
- parser . on ( '-f ID' , "Run spec with short id ID. Overrides -e option ." ) do |f |
21
+ parser . on ( '-f ID' , "Run spec with short id ID. Use multiple times to specify more than one id ." ) do |f |
22
22
short_ids << f
23
23
end
24
- parser . on ( "-h" , "--help" , "Show this message" ) do
24
+ parser . on ( "-h" , "--help" , "Show this message. " ) do
25
25
$stderr. puts parser
26
26
exit
27
27
end
@@ -45,11 +45,17 @@ if respond_to?(:run!)
45
45
config . update ( scheduler : XSpec ::Scheduler ::Filter . new (
46
46
scheduler : config . fetch ( :scheduler ) ,
47
47
filter : -> uow {
48
+ inc = true
49
+
48
50
if short_ids . any?
49
- short_ids . include? ( config . fetch ( :short_id ) . ( uow ) )
50
- else
51
- uow . full_name =~ filter
51
+ inc &&= short_ids . include? ( config . fetch ( :short_id ) . ( uow ) )
52
+ end
53
+
54
+ if filter
55
+ inc &&= uow . full_name =~ filter
52
56
end
57
+
58
+ inc
53
59
}
54
60
) )
55
61
}
You can’t perform that action at this time.
0 commit comments