Sha256: 88ca2a81b1f11d692a98dad91cb2d55e652f86bae81b8afae74a4e6b3e5393a9
Contents?: true
Size: 641 Bytes
Versions: 2
Compression:
Stored size: 641 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::Regexp do it 'nil -> nil' do Rasti::Types::Regexp.cast(nil).must_equal nil end ['[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 ['[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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-2.0.1 | spec/regexp_spec.rb |
rasti-types-2.0.0 | spec/regexp_spec.rb |