-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add indeterminate progress bar display when no total is given (ref #43)
- Loading branch information
1 parent
5a3da80
commit 77e6972
Showing
7 changed files
with
99 additions
and
19 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,28 @@ | ||
RSpec.describe TTY::ProgressBar, "indeterminate" do | ||
let(:output) { StringIO.new("", "w+") } | ||
|
||
it "animates indeterminate progress" do | ||
progress = described_class.new("[:bar]", output: output, width: 10) | ||
104.times { progress.advance } | ||
|
||
output.rewind | ||
expect(output.read).to eq([ | ||
"\e[1G[<=> ]" * 3, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 8, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=>]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 8, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[ <=> ]" * 7, | ||
"\e[1G[<=> ]" * 7, | ||
"\e[1G[ <=> ]" | ||
].join) | ||
end | ||
end |
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