triggerable 0.1.12 → 0.1.13

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: 0ffbad6c797667eac50c61320135f018b185cc3f
4
- data.tar.gz: 44f2d4c7b686d8919ed4192ec6ba9353f46fe31d
3
+ metadata.gz: 4ae7a6d0914d86abf6eefa16067fcc087d7d006f
4
+ data.tar.gz: 5b8690f8b3c063a708f23b03037f787ce7bdf943
5
5
  SHA512:
6
- metadata.gz: c71068450312d22d945a1ac3bd17c464faf9fc79972834ed555a550ab896e2725f264f00211b61280787c0424b5a5fadf3a34260eed3dee0263441c69cef7134
7
- data.tar.gz: b48a47ab7a51487d1d8ad0b8d588277839ae3980929559c3eb36599e8c10a7274576dfd029103cc65a295b515b25f6ec0261d086fd3fd1a08b87c91630b3613d
6
+ metadata.gz: 4133d5659157bad890dd95058b9b7da45749b6f125fb3f90f8395734f551fa1d9fa0fa89092367a47c41186a16f9c7c362312b1d331788695998655142df4853
7
+ data.tar.gz: 069cebeb6b6166db4fb38600b6391c7cdacdbef4433d962db8d3755034c015943073e30aa481d922c591c7986d25ff767d8387fa1d3e851d5b6456d0e38f7c66
@@ -14,6 +14,10 @@ module Triggerable
14
14
  "#{@field} #{@db_comparator} #{@value}"
15
15
  end
16
16
 
17
+ def scope table
18
+ Arel::Nodes::SqlLiteral.new("#{@field} #{@db_comparator} #{sanitized_value}")
19
+ end
20
+
17
21
  private
18
22
  def sanitized_value
19
23
  "(#{super.join(',')})"
@@ -1,3 +1,3 @@
1
1
  module Triggerable
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.13'
3
3
  end
@@ -29,6 +29,28 @@ describe 'Automations' do
29
29
  expect(TestTask.all.last.kind).to eq('follow up')
30
30
  end
31
31
 
32
+ it 'before+not_in' do
33
+ constantize_time_now Time.utc 2012, 9, 1, 12, 00
34
+
35
+ TestTask.automation if: {and: [{scheduled_at: {before: 2.hours}}, {status: {not_in: [:solved, :completed]}}]} do
36
+ TestTask.create kind: 'follow up'
37
+ end
38
+
39
+ task = TestTask.create scheduled_at: Time.utc(2012, 9, 1, 20, 00)
40
+ expect(TestTask.count).to eq(1)
41
+ task.update_attributes status: 'open', kind: 'service'
42
+ expect(TestTask.count).to eq(1)
43
+
44
+ constantize_time_now Time.utc 2012, 9, 1, 15, 00
45
+ Triggerable::Engine.run_automations(1.hour)
46
+ expect(TestTask.count).to eq(1)
47
+
48
+ constantize_time_now Time.utc 2012, 9, 1, 18, 00
49
+ Triggerable::Engine.run_automations(1.hour)
50
+ expect(TestTask.count).to eq(2)
51
+ expect(TestTask.all.last.kind).to eq('follow up')
52
+ end
53
+
32
54
  it 'before' do
33
55
  constantize_time_now Time.utc 2012, 9, 1, 12, 00
34
56
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triggerable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev