Skip to content

Commit

Permalink
Change to collapse queries as done is equivalent to success and error
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Aug 6, 2017
1 parent 42d8185 commit 52c1d90
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/tty/spinner/multi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ def auto_spin
# @api public
def count_line_offset(index)
Array(@spinners[index..-1]).reduce(0) do |acc, spinner|
if spinner.spinning? || spinner.success? ||
spinner.error? || spinner.done?
if spinner.spinning? || spinner.done?
acc += 1
end
acc
Expand Down
6 changes: 2 additions & 4 deletions spec/unit/multi/count_line_offset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
mock = double("TTY::Spinner",
add_multispinner: nil,
:spinning? => false,
:success? => false,
:error? => false,
:done? => false
)
spinners = TTY::Spinner::Multi.new(output: output)
allow(TTY::Spinner).to receive(:new).and_return(mock)

spinners.register ""
spinners.register "example"

expect(spinners.count_line_offset(0)).to eq(0)
expect(spinners.count_line_offset(99)).to eq(0)
Expand All @@ -25,7 +23,7 @@
spinners = TTY::Spinner::Multi.new(output: output)
allow(TTY::Spinner).to receive(:new).and_return(mock)

spinners.register ""
spinners.register "example"

expect(spinners.count_line_offset(0)).to eq(1)
end
Expand Down

0 comments on commit 52c1d90

Please sign in to comment.