Sha256: 80a6bf0d8ff1f6b10a9d492025966cf21089a7e7027b467074b02a44164db135

Contents?: true

Size: 1.97 KB

Versions: 19

Compression:

Stored size: 1.97 KB

Contents

require 'test/unit'
require "test_helper"

class TC_Datafy < Test::Unit::TestCase

  def test_make_data_uri_text_plain
    assert_equal(SHORT_TEXT_PLAIN_URI, Datafy::make_data_uri(SHORT_STRING, TEXT_PLAIN))
    assert_equal(LONG_TEXT_PLAIN_URI, Datafy::make_data_uri(LONG_STRING, TEXT_PLAIN))
  end

  def test_make_data_uri_octet_stream
    assert_equal(SHORT_APPLICATION_OCTET_STREAM_URI, Datafy::make_data_uri(SHORT_STRING, APPLICATION_OCTET_STREAM))
    assert_equal(LONG_APPLICATION_OCTET_STREAM_URI, Datafy::make_data_uri(LONG_STRING, APPLICATION_OCTET_STREAM))
  end

  # mime types
  TEXT_PLAIN = 'text/plain'
  APPLICATION_OCTET_STREAM = 'application/octet-stream'

  # string versions
  SHORT_STRING = 'this is some text'
  SHORT_BASE64 = 'dGhpcyBpcyBzb21lIHRleHQ='
  SHORT_URLENCODED = 'this+is+some+text'

  LONG_STRING = 'this is a really long string. this is a really long string. this is a really long string. this is a really long string. this is a really long string. this is a really long string. this is a really long string. this is a really long string.'
  LONG_BASE64 = 'dGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4gdGhpcyBpcyBhIHJlYWxseSBsb25nIHN0cmluZy4='
  LONG_URLENCODED = 'this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.+this+is+a+really+long+string.'

  # data: uris
  SHORT_APPLICATION_OCTET_STREAM_URI = "data:#{APPLICATION_OCTET_STREAM};base64,#{SHORT_BASE64}"
  SHORT_TEXT_PLAIN_URI = "data:#{TEXT_PLAIN},#{SHORT_URLENCODED}"

  LONG_APPLICATION_OCTET_STREAM_URI = "data:#{APPLICATION_OCTET_STREAM};base64,#{LONG_BASE64}"
  LONG_TEXT_PLAIN_URI = "data:#{TEXT_PLAIN},#{LONG_URLENCODED}"


end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
juicer-1.0.13 test/unit/juicer/datafy_test.rb
psyho_juicer-1.0.11 test/unit/juicer/datafy_test.rb
juicer-1.0.12 test/unit/juicer/datafy_test.rb
juicer-1.0.11 test/unit/juicer/datafy_test.rb
juicer-1.0.10 test/unit/juicer/datafy_test.rb
psyho_juicer-1.0.9 test/unit/juicer/datafy_test.rb
juicer-1.0.9 test/unit/juicer/datafy_test.rb
juicer-1.0.8 test/unit/juicer/datafy_test.rb
juicer-1.0.7 test/unit/juicer/datafy_test.rb
psyho_juicer-1.0.7 test/unit/juicer/datafy_test.rb
juicer-1.0.6 test/unit/juicer/datafy_test.rb
juicer-1.0.5 test/unit/juicer/datafy_test.rb
juicer-1.0.4 test/unit/juicer/datafy_test.rb
juicer-1.0.3 test/unit/juicer/datafy_test.rb
juicer-1.0.2 test/unit/juicer/datafy_test.rb
juicer-1.0.1 test/unit/juicer/datafy_test.rb
psyho_juicer-1.0.0 test/unit/juicer/datafy_test.rb
juicer-1.0.0 test/unit/juicer/datafy_test.rb
ktheory-juicer-1.0.0.ktheory1 test/unit/juicer/datafy_test.rb