Sha256: c4ee74ca9020dd315395e7fef6510f0422f0384f871f5d41afe8431eeb3f90f2
Contents?: true
Size: 1.56 KB
Versions: 5
Compression:
Stored size: 1.56 KB
Contents
require "spec_helper" describe Rico::Resolver do describe ".to_proc" do it "returns nil for data without type" do datas = [ { "a" => "b" }, { "c" => "d" }, { "f" => "e" } ] conflicted = RiakHelpers.build_conflicted_robject "resolver_proc_no_type", datas Rico::Resolver.to_proc.call(conflicted).should eql nil end it "returns nil for data with conflicted types" do datas = [ { "_type" => "array", "_values" => [1,2,3,4,1] }, { "_type" => "set", "_values" => [1,2,3,4] } ] conflicted = RiakHelpers.build_conflicted_robject "resolver_proc_conflicted_types", datas Rico::Resolver.to_proc.call(conflicted).should eql nil end it "returns nil for data without a known rico class" do datas = [ { "_type" => "unknown", "_values" => [1,2,3] }, { "_type" => "unknown", "_values" => [1,2,3,4] } ] conflicted = RiakHelpers.build_conflicted_robject "resolver_proc_unknown_type", datas Rico::Resolver.to_proc.call(conflicted).should eql nil end it "returns the result of the resolve function on known types" do datas = [ { "_type" => "array", "_values" => [1,2,3] }, { "_type" => "array", "_values" => [1,2,3,4] } ] conflicted = RiakHelpers.build_conflicted_robject "resolver_proc_no_resolve_function", datas Rico::Array.stub(:resolve).and_return(conflicted.siblings.last) Rico::Resolver.to_proc.call(conflicted).should eql conflicted.siblings.last Rico::Array.unstub(:resolve) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rico-0.5.0 | spec/resolver_spec.rb |
rico-0.4.0 | spec/resolver_spec.rb |
rico-0.3.0 | spec/resolver_spec.rb |
rico-0.2.0 | spec/resolver_spec.rb |
rico-0.1.0 | spec/resolver_spec.rb |