Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/guard/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def run_on_modifications(paths)
_throw_if_failed { runner.run(paths) }
end

alias run_on_additions run_on_modifications

private

def _throw_if_failed
Expand Down
19 changes: 19 additions & 0 deletions spec/lib/guard/rspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,23 @@
plugin.run_on_modifications(paths)
end
end

describe "#run_on_additions" do
let(:paths) { %w[path1 path2] }
it "runs all specs via runner" do
expect(runner).to receive(:run).with(paths) { true }
plugin.run_on_additions(paths)
end

it "does nothing if paths empty" do
expect(runner).to_not receive(:run)
plugin.run_on_additions([])
end

it "throws task_has_failed if runner return false" do
allow(runner).to receive(:run) { false }
expect(plugin).to receive(:throw).with(:task_has_failed)
plugin.run_on_additions(paths)
end
end
end