Sha256: 210255b5dd26a46493d6ecd6a3618cd616c29f4f44ebf1105be5c38c9df28e04

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

# encoding: UTF-8
require 'test_helper'

class TestColorer < Pizzazz::TestCase
  def test_that_it_colors_hashes
    colored = Pizzazz.ify({:foo => 'bar'})
    assert_equal colored, %Q{{
  <span class="string key">"foo"</span>: <span class="string">"bar"</span>
}}
  end

  def test_tabs
    colored = Pizzazz.ify({:foo => 'bar'}, tab: '||||')
    assert_equal colored, %Q{{
||||<span class="string key">"foo"</span>: <span class="string">"bar"</span>
}}
  end

  def test_that_it_truncates_arrays
    colored = Pizzazz.ify({:numbers => [1, 2, 3]}, :array_limit => 2)
    assert_equal colored, %Q{{
  <span class=\"string key\">\"numbers\"</span>: [
    <span class=\"number\">1</span>,
    <span class=\"number\">2</span>,
    …
  ]
}}

    colored = Pizzazz.ify({:numbers => [1, 2, 3]}, :array_limit => 1, :array_omission => 'hello')
    assert_equal colored, %Q{{
  <span class=\"string key\">\"numbers\"</span>: [
    <span class=\"number\">1</span>,
    hello
  ]
}}
  end

  def test_that_it_truncates_values
    colored = Pizzazz.ify({:wooden => 'baseball bat'}, :value_limit => 5)
    assert_equal colored, %Q{{
  <span class="string key">"wooden"</span>: <span class="string">"base…"</span>
}}

    colored = Pizzazz.ify({:wooden => 'baseball bat'}, :value_limit => 9, :value_omission => '!')
    assert_equal colored, %Q{{
  <span class="string key">"wooden"</span>: <span class="string">"baseball!"</span>
}}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pizzazz-0.1.5 test/units/colorer_test.rb