Sha256: 3e07c818c174345bd04b646f107e8ff35ae43bdcc70c44dfc8d068b014537b97

Contents?: true

Size: 619 Bytes

Versions: 27

Compression:

Stored size: 619 Bytes

Contents

require 'spec_helper'

describe MongoDoc::Validations do

  class ValidationTest
    include MongoDoc::Document

    attr_accessor :data
    validates_presence_of :data
  end

  context "requirements" do
    subject { ValidationTest.new }

    it { should respond_to(:valid?) }
    it { should respond_to(:errors) }

    it "is included by Document" do
      ::ActiveModel::Validations.should === subject
    end
  end

  context "validations" do
    it "valid? fails when a document is invalid" do
      doc = ValidationTest.new
      doc.should_not be_valid
      doc.should have(1).error_on(:data)
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongo_doc-0.6.26 spec/validations_spec.rb
mongo_doc-0.6.25 spec/validations_spec.rb
mongo_doc-0.6.23 spec/validations_spec.rb
mongo_doc-0.6.22 spec/validations_spec.rb
mongo_doc-0.6.21 spec/validations_spec.rb
mongo_doc-0.6.20 spec/validations_spec.rb
mongo_doc-0.6.19 spec/validations_spec.rb
mongo_doc-0.6.18 spec/validations_spec.rb
mongo_doc-0.6.17 spec/validations_spec.rb
mongo_doc-0.6.16 spec/validations_spec.rb
mongo_doc-0.6.15 spec/validations_spec.rb
mongo_doc-0.6.14 spec/validations_spec.rb
mongo_doc-0.6.13 spec/validations_spec.rb
mongo_doc-0.6.12 spec/validations_spec.rb
mongo_doc-0.6.11 spec/validations_spec.rb
mongo_doc-0.6.10 spec/validations_spec.rb
mongo_doc-0.6.9 spec/validations_spec.rb
mongo_doc-0.6.8 spec/validations_spec.rb
mongo_doc-0.6.7 spec/validations_spec.rb
mongo_doc-0.6.6 spec/validations_spec.rb