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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc9e1201d81e4cdc7758f504eb7ffcb95e880a7e
4
- data.tar.gz: 18962f87a51fceeaf4a935a0b8ca60217f31b903
3
+ metadata.gz: 2cec8ee6dff6041893f565479b9ab21a320ca1fc
4
+ data.tar.gz: d8f1d8e01769d88d9374ab0205bb1eb58204450e
5
5
  SHA512:
6
- metadata.gz: 638ac7bf06ecf8f036b3987bdd75037f9a654375a210a21ef85ec92959914d54b77ed5244a6d1531aa48a59795ff0ce6a796ec8316f774d950972fc5322c94cf
7
- data.tar.gz: b9efde17de7bcbb37b82890335ec3cb1fc74367616a469ccc8ef1f71b8e67ef28bfa3936966b6bbdc8562c3955f83b427cb299803f0539a395d8f29d04bef8dd
6
+ metadata.gz: c6a1583904ec2e3865b11e2ec213c9744698ee9b4c0c4efeea918e1501b5200cbd723a8dc3a0025d8914f6556eed43e12d225c3105b904ebd6f008e65fc6aae2
7
+ data.tar.gz: c24e52820b0b5acbfaf89b26d744cec68a7933812edc26549c260691503c6d3d8018df2257c180e36ea82e5b53d15d2362cbcfdec9a39745f1f25e1e3d93ae81
@@ -1,10 +1,7 @@
1
1
  module TriggeredJob
2
2
  class Base
3
- def self.triggered_by(table: nil, field: nil)
4
- raise ArgumentError, ":table argument is required" if table.nil?
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
@@ -1,3 +1,3 @@
1
1
  module TriggeredJob
2
- VERSION = "0.0.2".freeze unless defined?(TriggeredJob::VERSION)
2
+ VERSION = "0.0.3".freeze unless defined?(TriggeredJob::VERSION)
3
3
  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
- context "missing required attributes" do
7
- it "raises exception when missing :table" do
8
- begin
9
- expect {
10
- class A < TriggeredJob::Base
11
- triggered_by field: "my_field"
12
- end
13
- }.to raise_error(ArgumentError, /table/)
14
- ensure
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 table+field trigger with itself" do
18
+ it "registers trigger with itself" do
33
19
  begin
34
20
  class A < TriggeredJob::Base
35
- triggered_by table: "table", field: "field"
21
+ triggered_by "table__field"
36
22
  end
37
23
 
38
24
  expect(TriggeredJob.triggered_by("table__field")).to contain_exactly("A")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triggered_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Hanson