-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid double outputs clear on file changes
- Loading branch information
Showing
5 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'spec_helper' | ||
|
||
describe Guard::UI do | ||
|
||
describe "clear" do | ||
context "Guard.options[:clear] is true" do | ||
before { ::Guard.stub(:options) { { clear: true } } } | ||
|
||
it "clears the outputs if clearable" do | ||
Guard::UI.clearable | ||
Guard::UI.should_receive(:system).with('clear;') | ||
Guard::UI.clear | ||
end | ||
|
||
it "doesn't clear the output if already cleared" do | ||
Guard::UI.stub(:system) | ||
Guard::UI.clear | ||
Guard::UI.should_not_receive(:system).with('clear;') | ||
Guard::UI.clear | ||
end | ||
|
||
it "clears the outputs if forced" do | ||
Guard::UI.stub(:system) | ||
Guard::UI.clear | ||
Guard::UI.should_receive(:system).with('clear;') | ||
Guard::UI.clear(force: true) | ||
end | ||
end | ||
|
||
context "Guard.options[:clear] is false" do | ||
before { ::Guard.stub(:options) { { clear: false } } } | ||
|
||
it "doesn't clear the output" do | ||
Guard::UI.should_not_receive(:system).with('clear;') | ||
Guard::UI.clear | ||
end | ||
end | ||
end | ||
|
||
end |