sequel_bitemporal 0.7.1 → 0.7.3
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/sequel/plugins/bitemporal.rb +6 -0
- data/sequel_bitemporal.gemspec +1 -1
- data/spec/bitemporal_date_spec.rb +9 -2
- data/spec/bitemporal_date_with_range_spec.rb +8 -2
- data/spec/bitemporal_time_spec.rb +2 -2
- data/spec/bitemporal_time_with_range_spec.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a92636e68d57dc21742b7f664b9ba4f1042aa37
|
4
|
+
data.tar.gz: 42a33f9d3da3ca8e286ed3d95290a07471704173
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579fdd010ee26ef0ac9a2893b1f9f7a17a9f29a075e6a84f9554e745214c239bc510f0bad390645ce164778dfe55621b8f0f3c0a0c65db2322368d8037e9aadb
|
7
|
+
data.tar.gz: 8668c8274359b5ca91cdd4a46845486e6e3ef5a03d7078a9401a280d24ed7149dae907911c11d476bed390c07808b1dedf2a742b0295566263d3b722faef603d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
@@ -403,6 +403,10 @@ module Sequel
|
|
403
403
|
super
|
404
404
|
end
|
405
405
|
|
406
|
+
def propagated_during_last_save
|
407
|
+
@propagated_during_last_save ||= []
|
408
|
+
end
|
409
|
+
|
406
410
|
private
|
407
411
|
|
408
412
|
def prepare_pending_version
|
@@ -436,6 +440,7 @@ module Sequel
|
|
436
440
|
|
437
441
|
def propagate_changes_to_future_versions
|
438
442
|
return true unless self.class.propagate_per_column
|
443
|
+
@propagated_during_last_save = []
|
439
444
|
lock!
|
440
445
|
futures = versions_dataset.where expired_at: nil
|
441
446
|
futures = futures.exclude "valid_from=valid_to"
|
@@ -519,6 +524,7 @@ module Sequel
|
|
519
524
|
propagated.set_all version_attributes.merge(attributes)
|
520
525
|
propagated.save validate: false
|
521
526
|
propagated.send :_refresh_set_values, propagated.values
|
527
|
+
propagated_during_last_save << propagated
|
522
528
|
propagated
|
523
529
|
end
|
524
530
|
|
data/sequel_bitemporal.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "sequel_bitemporal"
|
6
|
-
s.version = "0.7.
|
6
|
+
s.version = "0.7.3"
|
7
7
|
s.authors = ["Joseph HALTER", "Jonathan TRON"]
|
8
8
|
s.email = ["joseph.halter@thetalentbox.com", "jonathan.tron@thetalentbox.com"]
|
9
9
|
s.homepage = "https://github.com/TalentBox/sequel_bitemporal"
|
@@ -344,12 +344,15 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
344
344
|
initial_today = Date.today
|
345
345
|
Timecop.freeze initial_today+1 do
|
346
346
|
master.update_attributes valid_from: initial_today+4, name: "King Size", price: 15, length: 2, width: 2
|
347
|
+
master.propagated_during_last_save.should have(0).item
|
347
348
|
end
|
348
349
|
Timecop.freeze initial_today+2 do
|
349
350
|
master.update_attributes valid_from: initial_today+3, length: 1, width: 1
|
351
|
+
master.propagated_during_last_save.should have(0).item
|
350
352
|
end
|
351
353
|
Timecop.freeze initial_today+3 do
|
352
354
|
master.update_attributes valid_from: initial_today+2, length: 3, width: 4
|
355
|
+
master.propagated_during_last_save.should have(1).item
|
353
356
|
end
|
354
357
|
master.should have_versions %Q{
|
355
358
|
| name | price | length | width | created_at | expired_at | valid_from | valid_to | current |
|
@@ -413,6 +416,7 @@ describe "Sequel::Plugins::Bitemporal" do
|
|
413
416
|
master.update_attributes name: "Single Standard", price: 98
|
414
417
|
Timecop.freeze Date.today - 100 do
|
415
418
|
master.update_attributes name: "Single Standard", price: 95
|
419
|
+
master.propagated_during_last_save.should have(0).item
|
416
420
|
end
|
417
421
|
master.should have_versions %Q{
|
418
422
|
| name | price | created_at | expired_at | valid_from | valid_to | current |
|
@@ -665,7 +669,7 @@ describe "Sequel::Plugins::Bitemporal", "with audit" do
|
|
665
669
|
after do
|
666
670
|
Timecop.return
|
667
671
|
end
|
668
|
-
let(:author){
|
672
|
+
let(:author){ double :author, audit_kind: "user" }
|
669
673
|
it "generates a new audit on creation" do
|
670
674
|
master = @master_class.new
|
671
675
|
master.should_receive(:updated_by).and_return author
|
@@ -716,11 +720,13 @@ describe "Sequel::Plugins::Bitemporal", "with audit" do
|
|
716
720
|
Timecop.freeze initial_today+1 do
|
717
721
|
Sequel::Plugins::Bitemporal.at initial_today+4 do
|
718
722
|
master.update_attributes valid_from: initial_today+4, name: "King Size", price: 15, length: 2, width: 2
|
723
|
+
master.propagated_during_last_save.should have(0).item
|
719
724
|
end
|
720
725
|
end
|
721
726
|
Timecop.freeze initial_today+2 do
|
722
727
|
Sequel::Plugins::Bitemporal.at initial_today+3 do
|
723
728
|
master.update_attributes valid_from: initial_today+3, length: 1, width: 1
|
729
|
+
master.propagated_during_last_save.should have(0).item
|
724
730
|
end
|
725
731
|
end
|
726
732
|
@audit_class.should_receive(:audit).with(
|
@@ -740,6 +746,7 @@ describe "Sequel::Plugins::Bitemporal", "with audit" do
|
|
740
746
|
Timecop.freeze initial_today+3 do
|
741
747
|
Sequel::Plugins::Bitemporal.at initial_today+2 do
|
742
748
|
master.update_attributes valid_from: initial_today+2, length: 3, width: 4
|
749
|
+
master.propagated_during_last_save.should have(1).item
|
743
750
|
end
|
744
751
|
end
|
745
752
|
ensure
|
@@ -754,7 +761,7 @@ describe "Sequel::Plugins::Bitemporal", "with audit, specifying how to get the a
|
|
754
761
|
end
|
755
762
|
db_setup audit_class: @audit_class, audit_updated_by_method: :author
|
756
763
|
end
|
757
|
-
let(:author){
|
764
|
+
let(:author){ double :author, audit_kind: "user" }
|
758
765
|
before do
|
759
766
|
Timecop.freeze 2009, 11, 28
|
760
767
|
end
|
@@ -344,12 +344,15 @@ if DbHelpers.pg?
|
|
344
344
|
initial_today = Date.today
|
345
345
|
Timecop.freeze initial_today+1 do
|
346
346
|
master.update_attributes valid_from: initial_today+4, name: "King Size", price: 15, length: 2, width: 2
|
347
|
+
master.propagated_during_last_save.should have(0).item
|
347
348
|
end
|
348
349
|
Timecop.freeze initial_today+2 do
|
349
350
|
master.update_attributes valid_from: initial_today+3, length: 1, width: 1
|
351
|
+
master.propagated_during_last_save.should have(0).item
|
350
352
|
end
|
351
353
|
Timecop.freeze initial_today+3 do
|
352
354
|
master.update_attributes valid_from: initial_today+2, length: 3, width: 4
|
355
|
+
master.propagated_during_last_save.should have(1).item
|
353
356
|
end
|
354
357
|
master.should have_versions %Q{
|
355
358
|
| name | price | length | width | created_at | expired_at | valid_from | valid_to | current |
|
@@ -647,7 +650,7 @@ if DbHelpers.pg?
|
|
647
650
|
after do
|
648
651
|
Timecop.return
|
649
652
|
end
|
650
|
-
let(:author){
|
653
|
+
let(:author){ double :author, audit_kind: "user" }
|
651
654
|
it "generates a new audit on creation" do
|
652
655
|
master = @master_class.new
|
653
656
|
master.should_receive(:updated_by).and_return author
|
@@ -698,11 +701,13 @@ if DbHelpers.pg?
|
|
698
701
|
Timecop.freeze initial_today+1 do
|
699
702
|
Sequel::Plugins::Bitemporal.at initial_today+4 do
|
700
703
|
master.update_attributes valid_from: initial_today+4, name: "King Size", price: 15, length: 2, width: 2
|
704
|
+
master.propagated_during_last_save.should have(0).item
|
701
705
|
end
|
702
706
|
end
|
703
707
|
Timecop.freeze initial_today+2 do
|
704
708
|
Sequel::Plugins::Bitemporal.at initial_today+3 do
|
705
709
|
master.update_attributes valid_from: initial_today+3, length: 1, width: 1
|
710
|
+
master.propagated_during_last_save.should have(0).item
|
706
711
|
end
|
707
712
|
end
|
708
713
|
@audit_class.should_receive(:audit).with(
|
@@ -722,6 +727,7 @@ if DbHelpers.pg?
|
|
722
727
|
Timecop.freeze initial_today+3 do
|
723
728
|
Sequel::Plugins::Bitemporal.at initial_today+2 do
|
724
729
|
master.update_attributes valid_from: initial_today+2, length: 3, width: 4
|
730
|
+
master.propagated_during_last_save.should have(1).item
|
725
731
|
end
|
726
732
|
end
|
727
733
|
ensure
|
@@ -736,7 +742,7 @@ if DbHelpers.pg?
|
|
736
742
|
end
|
737
743
|
db_setup audit_class: @audit_class, audit_updated_by_method: :author, ranges: true
|
738
744
|
end
|
739
|
-
let(:author){
|
745
|
+
let(:author){ double :author, audit_kind: "user" }
|
740
746
|
before do
|
741
747
|
Timecop.freeze 2009, 11, 28
|
742
748
|
end
|
@@ -392,7 +392,7 @@ describe "Sequel::Plugins::Bitemporal", "with audit" do
|
|
392
392
|
after do
|
393
393
|
Timecop.return
|
394
394
|
end
|
395
|
-
let(:author){
|
395
|
+
let(:author){ double :author, audit_kind: "user" }
|
396
396
|
it "generates a new audit on creation" do
|
397
397
|
master = @master_class.new
|
398
398
|
master.should_receive(:updated_by).and_return author
|
@@ -446,7 +446,7 @@ describe "Sequel::Plugins::Bitemporal", "with audit, specifying how to get the a
|
|
446
446
|
after do
|
447
447
|
Timecop.return
|
448
448
|
end
|
449
|
-
let(:author){
|
449
|
+
let(:author){ double :author, audit_kind: "user" }
|
450
450
|
it "generates a new audit on creation" do
|
451
451
|
master = @master_class.new
|
452
452
|
master.should_receive(:author).and_return author
|
@@ -392,7 +392,7 @@ if DbHelpers.pg?
|
|
392
392
|
after do
|
393
393
|
Timecop.return
|
394
394
|
end
|
395
|
-
let(:author){
|
395
|
+
let(:author){ double :author, audit_kind: "user" }
|
396
396
|
it "generates a new audit on creation" do
|
397
397
|
master = @master_class.new
|
398
398
|
master.should_receive(:updated_by).and_return author
|
@@ -451,7 +451,7 @@ if DbHelpers.pg?
|
|
451
451
|
after do
|
452
452
|
Timecop.return
|
453
453
|
end
|
454
|
-
let(:author){
|
454
|
+
let(:author){ double :author, audit_kind: "user" }
|
455
455
|
it "generates a new audit on creation" do
|
456
456
|
master = @master_class.new
|
457
457
|
master.should_receive(:author).and_return author
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_bitemporal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph HALTER
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.2.
|
123
|
+
rubygems_version: 2.2.2
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: Bitemporal versioning for sequel.
|