glebtv_mongoid_userstamp 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec66d169aaec0ddf4865952f5ec28f7f0e2f22b325bbf7941abd9bc21d02e99d
4
- data.tar.gz: 7c164ab473f37429865ff71cf57c252202cc5ee678588dd4d5c948d89d966872
3
+ metadata.gz: baa875b76008936bf0ab968862c2402cc996be50da6597460679682f768ce87d
4
+ data.tar.gz: 91b99770c94fbed0bd6ebbfab098a6d0205107d9773c825be930dde9c79c6a47
5
5
  SHA512:
6
- metadata.gz: 9fe43db88f70dbb4ea18ea54d5abb3e61e0aaacf4f811b663fe2519cb20ca342e8f55c5da9011f7dd3c3ea4a888b555f79bd6164ceb07c58c8b245087cf9ee1b
7
- data.tar.gz: 11178e22482adea865b35d509e3570ca99fc921e418005059ca28e077243191a38641412327195baec360cf0ef623de4b8fc0f646b8d7fb95530b8453078d455
6
+ metadata.gz: c88703face9dbab1c7f7db92aea3dbea7e25aa0329674ca92353154120056c37884a2998a1da02f83704b6baa30cf0951f80e93b2a1c5642255b46d47c934594
7
+ data.tar.gz: b53b23b2a8f1c44d80e1cbb9aadc0f544048b4847d3fdc48af3033dc8d0caee795bfb45bf48c76737d2f3e9d76aa42a7c6fbc4b97c84ab68a8775d1963246839
@@ -3,8 +3,8 @@ module Mongoid
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- belongs_to Userstamp.config.creator_field, class_name: Userstamp.config.user_model_name, autosave: false, required: false
7
- belongs_to Userstamp.config.updater_field, class_name: Userstamp.config.user_model_name, autosave: false, required: false
6
+ belongs_to Userstamp.config.creator_field, class_name: Userstamp.config.user_model_name, autosave: false, optional: true
7
+ belongs_to Userstamp.config.updater_field, class_name: Userstamp.config.user_model_name, autosave: false, optional: true
8
8
 
9
9
  before_validation :set_updater
10
10
  before_validation :set_creator
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Userstamp
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.2'
4
4
  end
5
5
  end
@@ -130,6 +130,18 @@ describe Mongoid::Userstamp do
130
130
  end
131
131
  subject { Novel.new(name: 'Ethyl the Aardvark goes Quantity Surveying') }
132
132
 
133
+ context 'when created without user' do
134
+ before do
135
+ User.current = nil
136
+ subject.save!
137
+ end
138
+
139
+ it { expect(subject.c_by_id).to eq(nil) }
140
+ it { expect(subject.c_by).to eq(nil) }
141
+ it { expect(subject.u_by_id).to eq(nil) }
142
+ it { expect(subject.u_by).to eq(nil) }
143
+ end
144
+
133
145
  context 'when created by a user' do
134
146
  before do
135
147
  User.current = user_1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebtv_mongoid_userstamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GlebTv