historiographer 1.4.0 → 1.4.1

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: e2c323e0b16003b066c298e281147b86e810ee0f2b7cc5bc859bfad1c861795b
4
- data.tar.gz: 04b81492d7a2a24a8aa46935f64874f77521884dec9cd9aa2fd568785b399847
3
+ metadata.gz: cb038b8ee2ab30ab82ee72f3191328bf6dfbd895f1052d7023e75ccc4beb7189
4
+ data.tar.gz: 73e36c7f2576b916666ca4ecf43e8041f098faf6e0a8ed003db37f78b1515e48
5
5
  SHA512:
6
- metadata.gz: 8716822fb73b440fedb427ea732d87e15a4ffb4bc3ca902bfa57e4cbf5e9303fbc6a25482eadcbc9d00830eede9664685db8d05b05438a5fe08c32fa79c8e3ee
7
- data.tar.gz: 86ce1d84a483a5384aea9e0d043911edc0f1cb3f3bf6f970d1dccee22d3369a2ef6437f65e2de6e46f9df4ec68a76b189411805ba98cca4874b39513c1162b69
6
+ metadata.gz: 06b64598ac55f5c011f3e58bca504eaf270430b913e2eb00e74234d19b6601aeed4f4de75463d15a74e979effb3dcc0062f26273f46e021145a21eb9c7357ac9
7
+ data.tar.gz: c619f5a42db6e3fc8521445ed8c0d8517ce211591ffe440fdd08507e776b0e45b9dbbfa5962f11073c68bdad26a33593c538f4817ee2e2b48dd494eb5f162403
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: historiographer 1.4.0 ruby lib
5
+ # stub: historiographer 1.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "historiographer".freeze
9
- s.version = "1.4.0"
9
+ s.version = "1.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -91,7 +91,9 @@ module Historiographer
91
91
  end
92
92
 
93
93
  alias_method :destroy_without_history, :destroy
94
- def destroy_with_history(history_user_id: )
94
+ def destroy_with_history(history_user_id: nil)
95
+ history_user_absent_action if history_user_id.nil?
96
+
95
97
  current_history = histories.where(history_ended_at: nil).order("id desc").limit(1).last
96
98
  current_history.update!(history_ended_at: UTC.now) if current_history.present?
97
99
 
@@ -10,6 +10,7 @@ end
10
10
 
11
11
  class SafePost < ActiveRecord::Base
12
12
  include Historiographer::Safe
13
+ acts_as_paranoid
13
14
  end
14
15
 
15
16
  class SafePostHistory < ActiveRecord::Base
@@ -445,6 +446,30 @@ describe Historiographer do
445
446
  expect(PostHistory.where.not(deleted_at: nil).count).to eq 1
446
447
  expect(PostHistory.last.history_user_id).to eq 2
447
448
  end
449
+
450
+ it "works with Historiographer::Safe" do
451
+ post = SafePost.create(title: "HELLO", body: "YO", author_id: 1)
452
+
453
+ expect {
454
+ post.destroy
455
+ }.to_not raise_error
456
+
457
+ expect(SafePost.count).to eq 0
458
+ expect(post.deleted_at).to_not be_nil
459
+ expect(SafePostHistory.count).to eq 2
460
+ expect(SafePostHistory.current.last.deleted_at).to eq post.deleted_at
461
+
462
+ post2 = SafePost.create(title: "HELLO", body: "YO", author_id: 1)
463
+
464
+ expect {
465
+ post2.destroy!
466
+ }.to_not raise_error
467
+
468
+ expect(SafePost.count).to eq 0
469
+ expect(post2.deleted_at).to_not be_nil
470
+ expect(SafePostHistory.count).to eq 4
471
+ expect(SafePostHistory.current.where(safe_post_id: post2.id).last.deleted_at).to eq post2.deleted_at
472
+ end
448
473
  end
449
474
 
450
475
  describe "Scopes" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: historiographer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - brettshollenberger