Sha256: 9c0c316b9defb63db91a6416b7daf432e4228613420e29e347bb8704edf9c393
Contents?: true
Size: 893 Bytes
Versions: 14
Compression:
Stored size: 893 Bytes
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "/../../spec_helper.rb")) describe Mongoid::Versioning do describe "#version" do before do @post = Post.new end it "defaults to 1" do @post.version.should == 1 end context "when document is saved" do before do @post.title = "New" @version = Post.new(:title => "Test") Post.expects(:find).at_least(1).with(@post.id).returns(@version) @post.revise end it "increments the version" do @post.version.should == 2 end it "adds a snapshot of the document to the versions" do @post.title.should == "New" @post.version.should == 2 @post.versions.size.should == 1 version = @post.versions.first version.title.should == "Test" version.version.should == 1 end end end end
Version data entries
14 entries across 14 versions & 1 rubygems