Sha256: efe2c28a7bf20a410b99aa92c2dcf732476547c20b6d3d15a3cc6cb7ebf8a2e4

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')

describe ::Sparkr::Sparkline do

  it "format should work with arity == 2" do
    sparkline = Sparkr::Sparkline.new([5.5,20])
    sparkline.format do |tick, number|
      if number < 6.0
        tick = tick + "-"
      else
        tick
      end
    end
    assert_equal '▁-█', sparkline.to_s
  end

  it "format should work with arity == 3" do
    sparkline = Sparkr::Sparkline.new([5.5,20])
    sparkline.format do |tick, number, index|
      if index == 1
        tick = tick + "-"
      else
        tick
      end
    end
    assert_equal '▁█-', sparkline.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sparkr-0.3.1 test/sparkr/sparkline_test.rb