Sha256: a48da9c8ee96c8972de2b6a7dbd4cfda48b215cfb1445837c1fdc1eb7f499d75

Contents?: true

Size: 683 Bytes

Versions: 29

Compression:

Stored size: 683 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "/../../../spec_helper.rb"))

describe Mongoid::Commands::Validate do

  describe "#execute" do

    before do
      @document = stub(:run_callbacks)
    end

    it "validates the document" do
      @document.expects(:valid?).returns(true)
      Mongoid::Commands::Validate.execute(@document).should be_true
    end

    it "runs the before and after validate callbacks" do
      @document.expects(:valid?).returns(true)
      @document.expects(:run_callbacks).with(:before_validation)
      @document.expects(:run_callbacks).with(:after_validation)
      Mongoid::Commands::Validate.execute(@document)
    end

  end

end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
mongoid-0.9.2 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.9.1 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.9.0 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.10 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.9 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.8 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.7 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.6 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.5 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.4 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.3 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.2 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.8.1 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.10 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.9 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.8 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.7 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.6 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.5 spec/unit/mongoid/commands/validate_spec.rb
mongoid-0.7.4 spec/unit/mongoid/commands/validate_spec.rb