Sha256: 940dae9cb51788697d92b52b1f217111a17cee5aa0cc178641892d97dfcbce9e

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

RSpec.describe TTY::Spinner, "events" do
  let(:output) { StringIO.new("", "w+") }

  it "emits :done event" do
    events = []
    spinner = TTY::Spinner.new(output: output)
    spinner.on(:done) { events << :done }

    spinner.stop

    expect(events).to eq([:done])
  end

  it "emits :success event" do
    events = []
    spinner = TTY::Spinner.new(output: output)
    spinner.on(:done) { events << :done }
    spinner.on(:success) { events << :success }

    spinner.success

    expect(events).to match_array(%i[done success])
  end

  it "emits :error event" do
    events = []
    spinner = TTY::Spinner.new(output: output)
    spinner.on(:done) { events << :done }
    spinner.on(:error) { events << :error }

    spinner.error

    expect(events).to match_array(%i[done error])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
planter-cli-3.0.7 lib/tty-spinner/spec/unit/events_spec.rb
planter-cli-3.0.5 lib/tty-spinner/spec/unit/events_spec.rb
planter-cli-3.0.4 lib/tty-spinner/spec/unit/events_spec.rb
planter-cli-3.0.3 lib/tty-spinner/spec/unit/events_spec.rb
planter-cli-3.0.2 lib/tty-spinner/spec/unit/events_spec.rb