elastic_queue 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -2
- data/lib/elastic_queue/queueable.rb +0 -7
- data/lib/elastic_queue/version.rb +1 -1
- data/spec/lib/integration/elastic_queue_filters_spec.rb +2 -0
- data/spec/lib/integration/elastic_queue_persistence_spec.rb +2 -0
- data/spec/lib/integration/elastic_queue_query_spec.rb +2 -0
- data/spec/lib/integration/elastic_queue_queuable_spec.rb +2 -29
- data/spec/lib/integration/elastic_queue_sorts_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9056882ae5a6d02c8f6b18be717a34d908d174ab
|
4
|
+
data.tar.gz: 10683bfae76be54a3c63b6e39e340bbf994c0dc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 711303e69e8421e4a065bb13eb2a1e6ad94cd7ae7fe5eec2c844bdb91d5cc72bf17dc222e6e47d679e8c1b810167c82c1effe3b15318a87cc4c8611a2c07d852
|
7
|
+
data.tar.gz: 2ea0cd970a3af6d73241c994beb4dc90bd09c2ad62426272a389392d0e1b52d1e2d25fb5606bb26170c53892473a2ba65058838383748e1d644d5ff4d3e52adb
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
elastic_queue (0.0.
|
4
|
+
elastic_queue (0.0.13)
|
5
5
|
activerecord (~> 3.0)
|
6
6
|
activesupport (~> 3.0)
|
7
7
|
elasticsearch (~> 0.4)
|
@@ -63,7 +63,6 @@ PLATFORMS
|
|
63
63
|
ruby
|
64
64
|
|
65
65
|
DEPENDENCIES
|
66
|
-
activesupport (~> 3.0)
|
67
66
|
bundler (~> 1.0)
|
68
67
|
debugger (~> 1.6)
|
69
68
|
elastic_queue!
|
@@ -1,13 +1,6 @@
|
|
1
1
|
module ElasticQueue
|
2
2
|
module Queueable
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
after_commit :index_for_queues, if: :persisted?
|
7
|
-
after_touch :index_for_queues, if: :persisted?
|
8
|
-
before_destroy :remove_from_queue_indices
|
9
|
-
end
|
10
|
-
|
11
4
|
module ClassMethods
|
12
5
|
|
13
6
|
def queues(*queues)
|
@@ -7,6 +7,8 @@ describe 'ElasticQueue::Filters integration' do
|
|
7
7
|
queues :test_animals_queue
|
8
8
|
queue_attributes :dangerous, :cute, :birthdate, :name
|
9
9
|
not_analyzed_queue_attributes :species, :description
|
10
|
+
after_save :index_for_queues
|
11
|
+
before_destroy :remove_from_queue_indices
|
10
12
|
end
|
11
13
|
|
12
14
|
class TestAnimalsQueue < ElasticQueue::Base
|
@@ -6,6 +6,8 @@ describe ElasticQueue::Persistence do
|
|
6
6
|
include ElasticQueue::Queueable
|
7
7
|
queue_attributes :dangerous, :cute, :birthdate
|
8
8
|
not_analyzed_queue_attributes :species, :description, :name
|
9
|
+
after_save :index_for_queues
|
10
|
+
before_destroy :remove_from_queue_indices
|
9
11
|
end
|
10
12
|
|
11
13
|
class TestAnimalsQueue < ElasticQueue::Base
|
@@ -7,6 +7,8 @@ describe ElasticQueue::Query do
|
|
7
7
|
queues :test_animals_queue
|
8
8
|
queue_attributes :dangerous, :cute, :birthdate
|
9
9
|
not_analyzed_queue_attributes :species, :description, :name
|
10
|
+
after_save :index_for_queues
|
11
|
+
before_destroy :remove_from_queue_indices
|
10
12
|
end
|
11
13
|
|
12
14
|
class TestAnimalsQueue < ElasticQueue::Base
|
@@ -7,6 +7,8 @@ describe 'ElasticQueue::Queueable integration' do
|
|
7
7
|
queues :test_animals_queue
|
8
8
|
queue_attributes :dangerous, :cute, :birthdate
|
9
9
|
not_analyzed_queue_attributes :species, :description, :name
|
10
|
+
after_save :index_for_queues
|
11
|
+
before_destroy :remove_from_queue_indices
|
10
12
|
end
|
11
13
|
|
12
14
|
class TestAnimalsQueue < ElasticQueue::Base
|
@@ -20,35 +22,6 @@ describe 'ElasticQueue::Queueable integration' do
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
describe 'callbacks' do
|
24
|
-
before :each do
|
25
|
-
TestAnimalsQueue.create_index
|
26
|
-
@fluffy = Animal.create({ name: 'Fluffy' })
|
27
|
-
end
|
28
|
-
|
29
|
-
after :each do
|
30
|
-
Animal.all.each(&:destroy)
|
31
|
-
delete_index('test_animals_queue')
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'adds newly created models to the queue' do
|
35
|
-
# model was created in before block
|
36
|
-
expect(query_all('test_animals_queue')['hits']['hits'].first['_source']['name']).to eq 'Fluffy'
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'deletes deleted models from the queue' do
|
40
|
-
Animal.find(@fluffy.id).destroy
|
41
|
-
refresh_index('test_animals_queue')
|
42
|
-
expect(query_all('test_animals_queue')['hits']['total']).to be 0
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'updates a changed model in the queue' do
|
46
|
-
@fluffy.update_attributes(name: 'Muffy')
|
47
|
-
refresh_index('test_animals_queue')
|
48
|
-
expect(query_all('test_animals_queue')['hits']['hits'].first['_source']['name']).to eq 'Muffy'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
25
|
# TODO: Turn back on later
|
53
26
|
# describe '#add_queue' do
|
54
27
|
# after :each do
|
@@ -7,6 +7,8 @@ describe 'ElasticQueue::Sorts integration' do
|
|
7
7
|
queues :test_animals_queue
|
8
8
|
queue_attributes :dangerous, :cute, :birthdate
|
9
9
|
not_analyzed_queue_attributes :species, :description, :name
|
10
|
+
after_save :index_for_queues
|
11
|
+
before_destroy :remove_from_queue_indices
|
10
12
|
end
|
11
13
|
|
12
14
|
class TestAnimalsQueue < ElasticQueue::Base
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruth Thompson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|