Sha256: fb90f39ca2fe1249a8768a8cbb26fa600108879e7642d1cf9d4bf9a8a945fd4e
Contents?: true
Size: 1.59 KB
Versions: 4
Compression:
Stored size: 1.59 KB
Contents
# -*- coding: utf-8 -*- require "sixarm_ruby_to_id_test" describe Array do describe "#to_date_ids" do it "casts the items to date ids" do [" 2000-12-31 ", " 2001-12-31 ", " 2002-12-31 "].to_date_ids.must_equal ["2000-12-31", "2001-12-31", "2002-12-31"] [" X000-12-31 ", " Y001-12-31 ", " Z002-12-31 "].to_date_ids.must_equal [nil, nil, nil] end end describe "#to_stint_ids" do it "casts the items to stint ids" do [" 2000-12-30..2000-12-31 ", " 2001-12-30..2001-12-31 ", " 2002-12-30..2002-12-31 "].to_stint_ids.must_equal ["2000-12-30..2000-12-31", "2001-12-30..2001-12-31", "2002-12-30..2002-12-31"] [" A000-12-30..2000-12-31 ", " B001-12-30..2001-12-31 ", " C002-12-30..2002-12-31 "].to_stint_ids.must_equal [nil, nil, nil] end end describe "#to_i_ids" do it "casts the items to integer ids" do [" 1 ", " 2 ", " 3 "].to_i_ids.must_equal [1, 2, 3] [" X ", " Y ", " Z "].to_i_ids.must_equal [0, 0, 0] end end describe "#to_s_ids" do it "casts the items to string ids" do [" 1 ", " 2 ", " 3 "].to_s_ids.must_equal ["1", "2", "3"] [" X ", " Y ", " Z "].to_s_ids.must_equal ["X", "Y", "Z"] end end describe "#to_s_uuids" do it "casts the items to string uuids" do [" 0000aaaa-00aa-00aa-00aa-000000aaaaaa ", " 1111bbbb-11bb-11bb-11bb-111111bbbbbb ", " 2222cccc-22cc-22cc-22cc-222222cccccc "].to_s_uuids.must_equal ["0000aaaa-00aa-00aa-00aa-000000aaaaaa", "1111bbbb-11bb-11bb-11bb-111111bbbbbb", "2222cccc-22cc-22cc-22cc-222222cccccc"] [" X ", " Y ", " Z "].to_s_uuids.must_equal [nil, nil, nil] end end end
Version data entries
4 entries across 4 versions & 1 rubygems