Sha256: 4d7bf3d3b8c6988b52e09f47884f9f8bac6200541b239d6721efeab09e7acb87

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

require "spec_helper"

describe Membrane::Schema::Regexp do
  let(:schema) { Membrane::Schema::Regexp.new(/bar/) }

  describe "#validate" do
    it "should raise an error if the validated object isn't a string" do
      expect_validation_failure(schema, 5, /instance of String/)
    end

    it "should raise an error if the validated object doesn't match" do
      expect_validation_failure(schema, "invalid", /match regex/)
    end

    it "should return nil if the validated object matches" do
      schema.validate("barbar").should be_nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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