Sha256: a843a5b18bf4d03fd80350ddf17a9594de86fdc2845cb0628e6e64685ad67cbe
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'struct_trans/test' describe 'StructTrans.trans_hash' do def verify struct, schema, result expect(StructTrans.trans_hash(struct, schema)).eq result end would 'raise TypeError for bad type' do expect.raise(TypeError) do StructTrans.trans_hash('nnf', 1) end end would 'transform with symbol' do verify('nnf', :reverse, 'fnn') end would 'transform with array' do verify('nnf', [:reverse, :capitalize], %w[fnn Nnf]) end would 'transform with hash' do verify('nnf', {:reverse => :capitalize}, {:reverse => 'Fnn'}) end would 'transform with array containing hashes' do verify('nnf', [:reverse, {:reverse => :capitalize}], ['fnn', :reverse => 'Fnn']) end would 'transform with array containing hashes containing arrays' do verify('nnf', [:reverse, {:reverse => [:capitalize, :upcase]}], ['fnn', :reverse => ['Fnn', 'FNN']]) end would 'transform with array containing hashes containing hashes' do verify('nnf', [:reverse, {:reverse => {:capitalize => :swapcase}}], ['fnn', :reverse => {:capitalize => 'fNN'}]) end would 'transform with array containing hashes containing mixed arrays' do verify('nnf', [:inspect, {:reverse => [{:capitalize => :swapcase}, :upcase]}], ['"nnf"', {:reverse => [{:capitalize => 'fNN'}, 'FNN']}]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
struct_trans-0.5.0 | test/test_trans_hash.rb |