triggered_job 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/triggered_job/base.rb +2 -5
- data/lib/triggered_job/version.rb +1 -1
- data/spec/lib/triggered_job/base_spec.rb +11 -25
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cec8ee6dff6041893f565479b9ab21a320ca1fc
|
4
|
+
data.tar.gz: d8f1d8e01769d88d9374ab0205bb1eb58204450e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6a1583904ec2e3865b11e2ec213c9744698ee9b4c0c4efeea918e1501b5200cbd723a8dc3a0025d8914f6556eed43e12d225c3105b904ebd6f008e65fc6aae2
|
7
|
+
data.tar.gz: c24e52820b0b5acbfaf89b26d744cec68a7933812edc26549c260691503c6d3d8018df2257c180e36ea82e5b53d15d2362cbcfdec9a39745f1f25e1e3d93ae81
|
data/lib/triggered_job/base.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
module TriggeredJob
|
2
2
|
class Base
|
3
|
-
def self.triggered_by(
|
4
|
-
|
5
|
-
raise ArgumentError, ":field argument is required" if field.nil?
|
6
|
-
|
7
|
-
TriggeredJob.set_trigger([table, field].join("__"), self)
|
3
|
+
def self.triggered_by(trigger)
|
4
|
+
TriggeredJob.set_trigger(trigger, self)
|
8
5
|
end
|
9
6
|
end
|
10
7
|
end
|
@@ -3,36 +3,22 @@ require "support/constant_helpers"
|
|
3
3
|
|
4
4
|
RSpec.describe TriggeredJob::Base do
|
5
5
|
describe ".triggered_by" do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
remove_constants :A
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it "raises exception when missing :field" do
|
20
|
-
begin
|
21
|
-
expect {
|
22
|
-
class A < TriggeredJob::Base
|
23
|
-
triggered_by table: "my_table"
|
24
|
-
end
|
25
|
-
}.to raise_error(ArgumentError, /field/)
|
26
|
-
ensure
|
27
|
-
remove_constants :A
|
28
|
-
end
|
6
|
+
it "raises exception when trigger is missing" do
|
7
|
+
begin
|
8
|
+
expect {
|
9
|
+
class A < TriggeredJob::Base
|
10
|
+
triggered_by
|
11
|
+
end
|
12
|
+
}.to raise_error ArgumentError
|
13
|
+
ensure
|
14
|
+
remove_constants :A
|
29
15
|
end
|
30
16
|
end
|
31
17
|
|
32
|
-
it "registers
|
18
|
+
it "registers trigger with itself" do
|
33
19
|
begin
|
34
20
|
class A < TriggeredJob::Base
|
35
|
-
triggered_by
|
21
|
+
triggered_by "table__field"
|
36
22
|
end
|
37
23
|
|
38
24
|
expect(TriggeredJob.triggered_by("table__field")).to contain_exactly("A")
|