Sha256: 06b4def1187e56cdfe888d9cfbf4b0227f0d53fa89850ecb3e92c2f450610f3a
Contents?: true
Size: 416 Bytes
Versions: 9
Compression:
Stored size: 416 Bytes
Contents
require 'spec_helper' describe "Myrrha.coercions" do it "should support using user-defined domains" do name = Domain.sbyc{|s| s.is_a?(Symbol)} rules = Myrrha.coercions do |r| r.coercion String, name, lambda{|s,t| s.to_sym} r.coercion name, String, lambda{|s,t| s.to_s} end rules.coerce("hello", name).should eq(:hello) rules.coerce(:hello, String).should eq("hello") end end
Version data entries
9 entries across 9 versions & 1 rubygems