Sha256: 7af78587333b931cf2c4db08546fab9ee7ed2bc07c8d085499dce6166343bf3f
Contents?: true
Size: 810 Bytes
Versions: 2
Compression:
Stored size: 810 Bytes
Contents
# encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/../test_helper') describe ::Sparkr::Sparkline do it "format should work with an empty array" do sparkline = Sparkr::Sparkline.new([]) assert_equal '', sparkline.to_s end 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sparkr-0.4.1 | test/sparkr/sparkline_test.rb |
sparkr-0.4.0 | test/sparkr/sparkline_test.rb |