Sha256: d18cd6d532a30a3929d14628ad4c5f73b80edcfe3ca7bd1c661882544545ddfa
Contents?: true
Size: 890 Bytes
Versions: 4
Compression:
Stored size: 890 Bytes
Contents
require 'minitest_helper' describe Restruct::Id do Id = Restruct::Id it 'Return the namespace' do id = Id.new 'foo' id.must_equal 'foo' end it 'Prepend the namespace' do id = Id.new 'foo' id['bar'].must_equal 'foo:bar' end it 'Work in more than one level' do id_1 = Id.new 'foo' id_2 = Id.new id_1['bar'] id_2['baz'].must_equal 'foo:bar:baz' end it 'Be chainable' do id = Id.new 'foo' id['bar']['baz'].must_equal 'foo:bar:baz' end it 'Accept symbols' do id = Id.new :foo id[:bar].must_equal 'foo:bar' end it 'Accept numbers' do id = Id.new 'foo' id[3].must_equal 'foo:3' end it 'Split in sections' do id = Id.new(:foo)[:bar][:buz] id.sections.must_equal %w(foo bar buz) end it 'Customize separator' do id = Id.new('foo', '|')['bar']['buz'] id.must_equal 'foo|bar|buz' end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
restruct-0.1.0 | spec/id_spec.rb |
restruct-0.0.3 | spec/id_spec.rb |
restruct-0.0.2 | spec/id_spec.rb |
restruct-0.0.1 | spec/id_spec.rb |