Sha256: 86174f91d7c74a52fe122f71db3c04c99249b7400dc0b3256cf5c21bcb15c9d6

Contents?: true

Size: 566 Bytes

Versions: 4

Compression:

Stored size: 566 Bytes

Contents

require "spec_helper"

describe Membrane::Schemas::Enum do
  describe "#validate" do
    let (:int_schema) { Membrane::Schemas::Class.new(Integer) }
    let (:str_schema) { Membrane::Schemas::Class.new(String) }
    let (:enum_schema) { Membrane::Schemas::Enum.new(int_schema, str_schema) }

    it "should return an error if none of the schemas validate" do
      expect_validation_failure(enum_schema, :sym, /doesn't validate/)
    end

    it "should return nil if any of the schemas validate" do
      enum_schema.validate("foo").should be_nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
membrane-1.1.0 spec/schemas/enum_spec.rb
membrane-1.0.0 spec/schemas/enum_spec.rb
membrane-0.0.5 spec/schemas/enum_spec.rb
membrane-0.0.4 spec/schemas/enum_spec.rb