Module: Deep::Etest

Defined in:
lib/vex/base/enumerable/deep.rb

Instance Method Summary collapse

Instance Method Details

#test_camelized_keysObject



91
92
93
94
95
# File 'lib/vex/base/enumerable/deep.rb', line 91

def test_camelized_keys
  h = { :a => "a", :b_c => { :d => "dd", :video_test => "video_test "}}
  expected = { "A"=>"a", "BC" => { "VideoTest" => "video_test ", "D" => "dd" }}
  assert_equal(expected, h.camelize)
end

#test_camelized_keys_w_arrayObject



97
98
99
100
101
# File 'lib/vex/base/enumerable/deep.rb', line 97

def test_camelized_keys_w_array
  h = { :a => "a", :b_c => [{ :d => "dd"}, {:video_test => "video_test "}]}
  expected = { "A"=>"a", "BC" => [{"D" => "dd" }, { "VideoTest" => "video_test "}]}
  assert_equal(expected, h.camelize)
end

#test_missin_blockObject



103
104
105
106
107
# File 'lib/vex/base/enumerable/deep.rb', line 103

def test_missin_block
  assert_raise(LocalJumpError) {
    Deep.reject(%w(1 2), 3)
  }
end

#test_reject_blanksObject



79
80
81
82
83
# File 'lib/vex/base/enumerable/deep.rb', line 79

def test_reject_blanks
  h = { :a => "a", :b_c => { :d => nil, :video_test => "video_test "}, "x" => nil, "y" => [] }
  expected = { :a=>"a", :b_c => { :video_test => "video_test " }}
  assert_equal(expected, h.reject_blanks)
end

#test_reject_blanks_w_arrayObject



85
86
87
88
89
# File 'lib/vex/base/enumerable/deep.rb', line 85

def test_reject_blanks_w_array
  h = { :a => "a", :b_c => [{ :d => nil}, {:video_test => "video_test "}], "x" => nil, "y" => [] }
  expected = { :a=>"a", :b_c => [{ :video_test => "video_test " }]}
  assert_equal(expected, h.reject_blanks)
end