Sha256: 17be8d9f99033baaee5e68fe9127ddb84d9fc4edb2fce0869c63a48c82936035
Contents?: true
Size: 998 Bytes
Versions: 2
Compression:
Stored size: 998 Bytes
Contents
require "spec_helper" describe Membrane::Schema::Tuple do let(:schema) do Membrane::Schema::Tuple.new(Membrane::Schema::Class.new(String), Membrane::Schema::ANY, Membrane::Schema::Class.new(Integer)) end describe "#validate" do it "should raise an error if the validated object isn't an array" do expect_validation_failure(schema, {}, /Array/) end it "should raise an error if the validated object has too many/few items" do expect_validation_failure(schema, ["foo", 2], /element/) expect_validation_failure(schema, ["foo", 2, "bar", 3], /element/) end it "should raise an error if any of the items do not validate" do expect_validation_failure(schema, [5, 2, 0], /0 =>/) expect_validation_failure(schema, ["foo", 2, "foo"], /2 =>/) end it "should return nil when validation succeeds" do schema.validate(["foo", "bar", 5]).should be_nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
membrane-0.0.2 | spec/tuple_schema_spec.rb |
membrane-0.0.1 | spec/tuple_schema_spec.rb |