Sha256: 19bc790b6627a65a60bb92a0cd9497806a484ae66dcc3fd5054faa7afa081522
Contents?: true
Size: 568 Bytes
Versions: 4
Compression:
Stored size: 568 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::Regexp do ['[a-z]', /[a-z]/].each do |value| it "#{value.inspect} -> #{Regexp.new(value).inspect}" do Rasti::Types::Regexp.cast(value).must_equal Regexp.new(value).source end end [nil, '[a-z', :symbol, [1,2], {a: 1, b: 2}, Object.new, 5].each do |value| it "#{value.inspect} -> CastError" do error = proc { Rasti::Types::Regexp.cast(value) }.must_raise Rasti::Types::CastError error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Types::Regexp" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-1.1.2 | spec/regexp_spec.rb |
rasti-types-1.1.1 | spec/regexp_spec.rb |
rasti-types-1.1.0 | spec/regexp_spec.rb |
rasti-types-1.0.0 | spec/regexp_spec.rb |