journaled 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,106 +1,108 @@
1
1
  require 'rails_helper'
2
2
 
3
- # rubocop:disable Rails/SkipsModelValidations
4
- RSpec.describe "Raw database change protection" do
5
- let(:journaled_class) do
6
- Class.new(Delayed::Job) do
7
- include Journaled::Changes
3
+ if Rails::VERSION::MAJOR > 5 || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 2)
4
+ # rubocop:disable Rails/SkipsModelValidations
5
+ RSpec.describe "Raw database change protection" do
6
+ let(:journaled_class) do
7
+ Class.new(Delayed::Job) do
8
+ include Journaled::Changes
8
9
 
9
- journal_changes_to :locked_at, as: :attempt
10
+ journal_changes_to :locked_at, as: :attempt
11
+ end
10
12
  end
11
- end
12
13
 
13
- let(:journaled_class_with_no_journaled_columns) do
14
- Class.new(Delayed::Job) do
15
- include Journaled::Changes
14
+ let(:journaled_class_with_no_journaled_columns) do
15
+ Class.new(Delayed::Job) do
16
+ include Journaled::Changes
17
+ end
16
18
  end
17
- end
18
19
 
19
- describe "the relation" do
20
- describe "#update_all" do
21
- it "refuses on journaled columns" do
22
- expect { journaled_class.update_all(locked_at: nil) }.to raise_error(/aborted by Journaled/)
23
- end
20
+ describe "the relation" do
21
+ describe "#update_all" do
22
+ it "refuses on journaled columns" do
23
+ expect { journaled_class.update_all(locked_at: nil) }.to raise_error(/aborted by Journaled/)
24
+ end
24
25
 
25
- it "succeeds on unjournaled columns" do
26
- expect { journaled_class.update_all(handler: "") }.not_to raise_error
27
- end
26
+ it "succeeds on unjournaled columns" do
27
+ expect { journaled_class.update_all(handler: "") }.not_to raise_error
28
+ end
28
29
 
29
- it "succeeds when forced on journaled columns" do
30
- expect { journaled_class.update_all({ locked_at: nil }, force: true) }.not_to raise_error
30
+ it "succeeds when forced on journaled columns" do
31
+ expect { journaled_class.update_all({ locked_at: nil }, force: true) }.not_to raise_error
32
+ end
31
33
  end
32
- end
33
34
 
34
- describe "#delete" do
35
- it "refuses if journaled columns exist" do
36
- expect { journaled_class.delete(1) }.to raise_error(/aborted by Journaled/)
37
- end
35
+ describe "#delete" do
36
+ it "refuses if journaled columns exist" do
37
+ expect { journaled_class.delete(1) }.to raise_error(/aborted by Journaled/)
38
+ end
38
39
 
39
- it "succeeds if no journaled columns exist" do
40
- expect { journaled_class_with_no_journaled_columns.delete(1) }.not_to raise_error
41
- end
40
+ it "succeeds if no journaled columns exist" do
41
+ expect { journaled_class_with_no_journaled_columns.delete(1) }.not_to raise_error
42
+ end
42
43
 
43
- it "succeeds if journaled columns exist when forced" do
44
- expect { journaled_class.delete(1, force: true) }.not_to raise_error
44
+ it "succeeds if journaled columns exist when forced" do
45
+ expect { journaled_class.delete(1, force: true) }.not_to raise_error
46
+ end
45
47
  end
46
- end
47
48
 
48
- describe "#delete_all" do
49
- it "refuses if journaled columns exist" do
50
- expect { journaled_class.delete_all }.to raise_error(/aborted by Journaled/)
51
- end
49
+ describe "#delete_all" do
50
+ it "refuses if journaled columns exist" do
51
+ expect { journaled_class.delete_all }.to raise_error(/aborted by Journaled/)
52
+ end
52
53
 
53
- it "succeeds if no journaled columns exist" do
54
- expect { journaled_class_with_no_journaled_columns.delete_all }.not_to raise_error
55
- end
54
+ it "succeeds if no journaled columns exist" do
55
+ expect { journaled_class_with_no_journaled_columns.delete_all }.not_to raise_error
56
+ end
56
57
 
57
- it "succeeds if journaled columns exist when forced" do
58
- expect { journaled_class.delete_all(force: true) }.not_to raise_error
58
+ it "succeeds if journaled columns exist when forced" do
59
+ expect { journaled_class.delete_all(force: true) }.not_to raise_error
60
+ end
59
61
  end
60
62
  end
61
- end
62
63
 
63
- describe "an instance" do
64
- let(:job) do
65
- module TestJob
66
- def perform
67
- "foo"
68
- end
64
+ describe "an instance" do
65
+ let(:job) do
66
+ module TestJob
67
+ def perform
68
+ "foo"
69
+ end
69
70
 
70
- module_function :perform
71
+ module_function :perform
72
+ end
71
73
  end
72
- end
73
74
 
74
- subject { journaled_class.enqueue(job) }
75
+ subject { journaled_class.enqueue(job) }
75
76
 
76
- describe "#update_columns" do
77
- it "refuses on journaled columns" do
78
- expect { subject.update_columns(locked_at: nil) }.to raise_error(/aborted by Journaled/)
79
- end
77
+ describe "#update_columns" do
78
+ it "refuses on journaled columns" do
79
+ expect { subject.update_columns(locked_at: nil) }.to raise_error(/aborted by Journaled/)
80
+ end
80
81
 
81
- it "succeeds on unjournaled columns" do
82
- expect { subject.update_columns(handler: "") }.not_to raise_error
83
- end
82
+ it "succeeds on unjournaled columns" do
83
+ expect { subject.update_columns(handler: "") }.not_to raise_error
84
+ end
84
85
 
85
- it "succeeds when forced on journaled columns" do
86
- expect { subject.update_columns({ locked_at: nil }, force: true) }.not_to raise_error
86
+ it "succeeds when forced on journaled columns" do
87
+ expect { subject.update_columns({ locked_at: nil }, force: true) }.not_to raise_error
88
+ end
87
89
  end
88
- end
89
90
 
90
- describe "#delete" do
91
- it "refuses if journaled columns exist" do
92
- expect { subject.delete }.to raise_error(/aborted by Journaled/)
93
- end
91
+ describe "#delete" do
92
+ it "refuses if journaled columns exist" do
93
+ expect { subject.delete }.to raise_error(/aborted by Journaled/)
94
+ end
94
95
 
95
- it "succeeds if no journaled columns exist" do
96
- instance = journaled_class_with_no_journaled_columns.enqueue(job)
97
- expect { instance.delete }.not_to raise_error
98
- end
96
+ it "succeeds if no journaled columns exist" do
97
+ instance = journaled_class_with_no_journaled_columns.enqueue(job)
98
+ expect { instance.delete }.not_to raise_error
99
+ end
99
100
 
100
- it "succeeds if journaled columns exist when forced" do
101
- expect { subject.delete(force: true) }.not_to raise_error
101
+ it "succeeds if journaled columns exist when forced" do
102
+ expect { subject.delete(force: true) }.not_to raise_error
103
+ end
102
104
  end
103
105
  end
104
106
  end
107
+ # rubocop:enable Rails/SkipsModelValidations
105
108
  end
106
- # rubocop:enable Rails/SkipsModelValidations
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journaled
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Lipson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-06-10 00:00:00.000000000 Z
14
+ date: 2019-07-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: aws-sdk-resources
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  - !ruby/object:Gem::Version
296
296
  version: '0'
297
297
  requirements: []
298
- rubygems_version: 3.0.1
298
+ rubygems_version: 3.0.3
299
299
  signing_key:
300
300
  specification_version: 4
301
301
  summary: Journaling for Betterment apps.