Sha256: 207211391cf59c4bdb88bd5a40427a2162df91313b0a5680be975978804cdc68

Contents?: true

Size: 738 Bytes

Versions: 8

Compression:

Stored size: 738 Bytes

Contents

require 'test_helper'
require 'rmagick'

class BumpsparkTest < Test::Unit::TestCase
  
  context "generating pngs" do
    
    should "work for an empty bumpspark" do
      assert_valid_png []
    end
    
    should "work for a bumpspark with one datapoint" do
      assert_valid_png [1]      
    end
    
    should "work for a bumpspark with multiple datapoints" do
      assert_valid_png [1, 2, 3]
    end
    
  end
  
  def assert_valid_png(data)
    image = Magick::Image.from_blob(generate(data)).first
    assert image, "No valid image generated"
    assert_equal "image/png", image.mime_type, "Image has wrong mime type"
  end
  
  def generate(data, format=:png)
    Bumpspark::Graph.new(data).send("to_#{format}")
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
bruce-bumpspark-1.0.0 test/bumpspark_test.rb
bruce-bumpspark-1.0.1 test/bumpspark_test.rb
bruce-bumpspark-1.0.2 test/bumpspark_test.rb
bruce-bumpspark-1.0.3 test/bumpspark_test.rb
bruce-bumpspark-1.0.4 test/bumpspark_test.rb
bumpspark-1.1.1 test/bumpspark_test.rb
bumpspark-1.1.0 test/bumpspark_test.rb
bumpspark-1.0.4 test/bumpspark_test.rb