File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ def run_on_modifications(paths)
42
42
_throw_if_failed { runner . run ( paths ) }
43
43
end
44
44
45
+ alias_method :run_on_additions , :run_on_modifications
46
+
45
47
private
46
48
47
49
def _throw_if_failed
Original file line number Diff line number Diff line change 88
88
plugin . run_on_modifications ( paths )
89
89
end
90
90
end
91
+
92
+ describe "#run_on_additions" do
93
+ let ( :paths ) { %w( path1 path2 ) }
94
+ it "runs all specs via runner" do
95
+ expect ( runner ) . to receive ( :run ) . with ( paths ) { true }
96
+ plugin . run_on_additions ( paths )
97
+ end
98
+
99
+ it "does nothing if paths empty" do
100
+ expect ( runner ) . to_not receive ( :run )
101
+ plugin . run_on_additions ( [ ] )
102
+ end
103
+
104
+ it "throws task_has_failed if runner return false" do
105
+ allow ( runner ) . to receive ( :run ) { false }
106
+ expect ( plugin ) . to receive ( :throw ) . with ( :task_has_failed )
107
+ plugin . run_on_additions ( paths )
108
+ end
109
+ end
91
110
end
You can’t perform that action at this time.
0 commit comments