Sha256: 26171ec690974f614450339fb68283d81c3fd1c8649ef8ea9a711416e867d474

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

require "spec_helper"


describe Membrane::Schema::Class do
  describe "#validate" do
    let(:schema) { Membrane::Schema::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

2 entries across 2 versions & 1 rubygems

Version Path
membrane-0.0.2 spec/class_schema_spec.rb
membrane-0.0.1 spec/class_schema_spec.rb