Sha256: 51c6ec69057bbc4f09e3002284590cd79ba7dde768a2c455cda64b4cbf9fd531

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'minitest/autorun'
require 'ruby_wings'

class RubyWingsTest < MiniTest::Unit::TestCase

  def setup

  end

  def test_nil_is_blank
    assert(nil.blank?)
  end

  def test_empty_string_is_blank
    assert(''.blank?)
  end

  def test_string_is_not_blank
    assert_equal('foo'.blank?, false)
  end

  def test_hash_key_converts_to_symbol
    with_strings = { 'a' => 'b', 'c' => { 'd' => 'e', 'f' => [1, 2, 3] } }
    with_symbols = { :a => 'b', :c => { :d => 'e', :f => [1, 2, 3] } }
    assert_equal with_symbols, with_strings.symbolize
  end

  def test_deep_merge_merge_sub_hashes
    a = { :a => 'some_string', :b => { :foo => :bar, :with => { :even => [2, 'two', :two] } } }
    b = { :b => { :foo => :baz, :with => { :odd => [1, 'one', :one] } } }
    expected_result =  { :a => 'some_string',
                         :b => { :foo => :baz, :with => { :even => [2, 'two', :two], :odd => [1, 'one', :one] } } }
    assert_equal expected_result, a.deep_merge(b)
  end

  def test_deep_merge_overwrites_strings
    a = { :foo => 'bar' }
    b = { :foo => 'baz' }
    assert_equal b, a.merge(b)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_wings-0.2.0 test/ruby_wings.rb
ruby_wings-0.1.1 test/ruby_wings.rb
ruby_wings-0.1.0 test/ruby_wings.rb