Sha256: e350254b467958185d6d2c4301dd448661db231b66dbb4a69e126e324a83243d
Contents?: true
Size: 937 Bytes
Versions: 5
Compression:
Stored size: 937 Bytes
Contents
RSpec.describe TTY::Spinner::Multi, "#auto_spin" do let(:output) { StringIO.new("", "w+") } it "doesn't auto spin top level spinner" do spinners = TTY::Spinner::Multi.new("Top level spinner", output: output) allow(spinners.top_spinner).to receive(:auto_spin) spinners.auto_spin expect(spinners.top_spinner).to_not have_received(:auto_spin) end it "raises an exception when called without a top spinner" do spinners = TTY::Spinner::Multi.new(output: output) expect { spinners.auto_spin }.to raise_error(RuntimeError, /No top level spinner/) end it "auto spins top level & child spinners with jobs" do spinners = TTY::Spinner::Multi.new("top", output: output) jobs = [] spinners.register("one") { |sp| jobs << "one"; sp.success } spinners.register("two") { |sp| jobs << "two"; sp.success } spinners.auto_spin expect(jobs).to match_array(%w[one two]) end end
Version data entries
5 entries across 5 versions & 1 rubygems