File: case_crud_hash.rb

package info (click to toggle)
ruby-hashery 2.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 404 kB
  • sloc: ruby: 2,997; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'helper'

test_case CRUDHash do

  class_method :create do
    test do
      h = CRUDHash.create(:a=>1,:b=>2)
      h.assert == {:a=>1,:b=>2}
    end
  end

  class_method :auto do
    test 'without a block' do
      h = CRUDHash.auto
      h[:a].assert == {}
    end

    test 'with a block' do
      h = CRUDHash.auto{ [] }
      h[:a].assert == []
    end
  end

end


#
# OT: Why not make `:a=>1` a Pair object?
#