mongo_mapper_versioned 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  module MongoMapper
3
3
  module Plugins
4
4
  module Versioned
5
- Version = '0.1.9'
5
+ Version = '0.2.0'
6
6
  end
7
7
  end
8
8
  end
@@ -7,7 +7,7 @@ module MongoMapper
7
7
  configuration = { :ignored_keys => %w(_id version_number created_at updated_at creator_id updater_id) }
8
8
  configuration[:ignored_keys].concat(options[:ignored_keys]).uniq if options.key?(:ignored_keys)
9
9
 
10
- key :version_number, Integer, :index => true
10
+ key :version_number, Integer, :default => 1, :index => true
11
11
  many :versions, :class => MongoMapper::Plugins::Versioned::Version, :foreign_key => :versioned_id, :dependent => :destroy, :order => :version_number.asc
12
12
 
13
13
  after_create :create_version, :if => :should_create_initial_version?
@@ -23,8 +23,8 @@ class VersionedTest < ActiveSupport::TestCase
23
23
  setup do
24
24
  @doc = VersionedDoc.new
25
25
  end
26
- should "be on version 0" do
27
- assert_nil @doc.version_number
26
+ should "be on version 1" do
27
+ assert_equal 1, @doc.version_number
28
28
  end
29
29
  should "have 0 versions" do
30
30
  assert_equal 0, @doc.versions.count
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_mapper_versioned
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 9
10
- version: 0.1.9
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tomas Celizna