Sha256: 1d0a028d24d8173e6bae122f97c21af2327d9e2089f567bba399d7db6eaa41b5

Contents?: true

Size: 574 Bytes

Versions: 4

Compression:

Stored size: 574 Bytes

Contents

require "spec_helper"


describe Membrane::Schemas::Class do
  describe "#validate" do
    let(:schema) { Membrane::Schemas::Class.new(String) }

    it "should return nil for instances of the supplied class" do
      schema.validate("test").should be_nil
    end

    it "should return nil for subclasses of the supplied class" do
      class StrTest < String; end

      schema.validate(StrTest.new("hi")).should be_nil
    end

    it "should return an error for non class instances" do
      expect_validation_failure(schema, 10, /instance of String/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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