Sha256: 1b3a70c083b9b3655b8e83dc757e12747e6243a096aa04511936569ca4083b02

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

# frozen_string_literal: true

RSpec.describe TTY::Pie, '#update' do
  it "updates current data" do
    data = [ { name: 'BTC', value: 5977, fill: '*' } ]

    pie = TTY::Pie.new(data: data, radius: 2)

    output = pie.draw

    expect(output).to eq([
      "   ***\n",
      " *******\n",
      "*********    * BTC 100.00%\n",
      " *******\n",
      "   ***\n"
    ].join)

    pie.update([{name: 'LTC', value: 2030, fill: 'x'}])

    output = pie.draw

    expect(output).to eq([
      "   xxx\n",
      " xxxxxxx\n",
      "xxxxxxxxx    x LTC 100.00%\n",
      " xxxxxxx\n",
      "   xxx\n"
    ].join)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-pie-0.1.0 spec/unit/update_spec.rb