daengine 0.2.18 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/taxonomy_term.rb +2 -0
- data/app/service/digital_asset_lookup_service.rb +21 -0
- data/lib/daengine/version.rb +1 -1
- data/spec/dummy/log/test.log +14672 -19619
- data/spec/models/digital_asset_spec.rb +1 -1
- data/spec/service/digital_asset_lookup_service_spec.rb +82 -0
- metadata +4 -4
- data/spec/dummy/log/development.log +0 -19
@@ -7,7 +7,7 @@ describe DigitalAsset do
|
|
7
7
|
context '#fields' do
|
8
8
|
let(:defined_fields) {
|
9
9
|
[:title, :changed_at, :sami_code, :product_ids, :summary,
|
10
|
-
:published_at, :expires_at, :documents, :guid, :
|
10
|
+
:published_at, :expires_at, :documents, :guid, :audiences]
|
11
11
|
}
|
12
12
|
it 'has all defined fields' do
|
13
13
|
defined_fields.each {|f| should respond_to(f)}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DigitalAssetLookupService do
|
4
|
+
|
5
|
+
subject { FactoryGirl.build :digital_asset }
|
6
|
+
|
7
|
+
|
8
|
+
context '#document-query' do
|
9
|
+
before do
|
10
|
+
asset1 = FactoryGirl.create :digital_asset, :product_ids => ['303','420'],
|
11
|
+
:audiences => ['690'], :sami_code => 'F000000.BAR'
|
12
|
+
doc1 = FactoryGirl.build :document, :content_type => '909',
|
13
|
+
:path => '/1/foo/bar/foobar.doc'
|
14
|
+
doc2 = FactoryGirl.build :document, :path => '/2/foo/bar/foobar.doc'
|
15
|
+
|
16
|
+
asset1.documents << doc1
|
17
|
+
asset1.documents << doc2
|
18
|
+
asset1.save!
|
19
|
+
|
20
|
+
asset2 = FactoryGirl.create :digital_asset, :product_ids => ['420'],
|
21
|
+
:sami_code => 'MEH12345.000'
|
22
|
+
doc3 = FactoryGirl.build :document, :content_type => '549',
|
23
|
+
:path => '/1/foo/bar/FINRA-foobar.doc'
|
24
|
+
asset2.documents << doc3
|
25
|
+
asset2.save!
|
26
|
+
end
|
27
|
+
it 'supports query by product_id' do
|
28
|
+
query = {}
|
29
|
+
DigitalAsset.where(query).should have(2).digital_asset
|
30
|
+
query[:product_ids.in] = []
|
31
|
+
DigitalAsset.where(query).should have(0).digital_asset
|
32
|
+
query[:product_ids.in] = ['303']
|
33
|
+
DigitalAsset.where(query).should have(1).digital_asset
|
34
|
+
query[:product_ids.in] = ['303','420']
|
35
|
+
DigitalAsset.where(query).should have(2).digital_asset
|
36
|
+
end
|
37
|
+
it 'supports query by content_type_id' do
|
38
|
+
query = {}
|
39
|
+
query[:'documents.content_type'] = ''
|
40
|
+
DigitalAsset.where(query).should have(0).digital_asset
|
41
|
+
query[:'documents.content_type'] = '909'
|
42
|
+
DigitalAsset.where(query).should have(1).digital_asset
|
43
|
+
DigitalAssetLookupService.find_documents_by_query(nil, '909').should have(1).digital_asset
|
44
|
+
end
|
45
|
+
it 'supports query by product_id and content_type_id' do
|
46
|
+
query = {}
|
47
|
+
query[:'documents.content_type'] = '909'
|
48
|
+
query[:product_ids.in] = ['303','420']
|
49
|
+
DigitalAsset.where(query).should have(1).digital_asset
|
50
|
+
end
|
51
|
+
it 'supports query by product_id and content_type_id and audiences' do
|
52
|
+
query = {}
|
53
|
+
query[:'documents.content_type'] = '909'
|
54
|
+
query[:product_ids.in] = ['303','420']
|
55
|
+
query[:audiences.in] = ['690']
|
56
|
+
DigitalAsset.where(query).should have(1).digital_asset
|
57
|
+
end
|
58
|
+
it 'supports service query by product_type_id' do
|
59
|
+
DigitalAssetLookupService.find_documents_by_query(['420']).should have(2).digital_asset
|
60
|
+
DigitalAssetLookupService.find_documents_by_query('420').should have(2).digital_asset
|
61
|
+
DigitalAssetLookupService.find_documents_by_query('420').should have(2).digital_asset
|
62
|
+
DigitalAssetLookupService.find_documents_by_query(['420','303']).should have(2).digital_asset
|
63
|
+
DigitalAssetLookupService.find_documents_by_query('303').should have(1).digital_asset
|
64
|
+
DigitalAssetLookupService.find_documents_by_query('333').should have(0).digital_asset
|
65
|
+
DigitalAssetLookupService.find_documents_by_query().should have(2).digital_asset
|
66
|
+
end
|
67
|
+
it 'supports service query by content_type_id' do
|
68
|
+
DigitalAssetLookupService.find_documents_by_query(nil, ['909']).should have(1).digital_asset
|
69
|
+
DigitalAssetLookupService.find_documents_by_query(nil, '909').should have(1).digital_asset
|
70
|
+
end
|
71
|
+
it 'supports service query by product_type_id and content_type_id' do
|
72
|
+
DigitalAssetLookupService.find_documents_by_query(['303','420'], '909').should have(1).digital_asset
|
73
|
+
end
|
74
|
+
it 'supports service query by product_type_id, content_type_id and audience_ids' do
|
75
|
+
DigitalAssetLookupService.find_documents_by_query(['303','420'], '909', ['690']).should have(1).digital_asset
|
76
|
+
end
|
77
|
+
it 'supports service query by product_type_id and finra' do
|
78
|
+
DigitalAssetLookupService.find_documents_by_query('420',nil,nil,true).should have(1).digital_asset
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: daengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.19
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- sbhatia
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-18 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -127,7 +127,6 @@ files:
|
|
127
127
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
128
128
|
- spec/dummy/config/locales/en.yml
|
129
129
|
- spec/dummy/db/test.sqlite3
|
130
|
-
- spec/dummy/log/development.log
|
131
130
|
- spec/dummy/log/test.log
|
132
131
|
- spec/dummy/public/404.html
|
133
132
|
- spec/dummy/public/422.html
|
@@ -151,6 +150,7 @@ files:
|
|
151
150
|
- spec/mock_data/taxonomy/taxonomy.xml
|
152
151
|
- spec/mock_data/taxonomy/taxonomyengine.yml
|
153
152
|
- spec/models/digital_asset_spec.rb
|
153
|
+
- spec/service/digital_asset_lookup_service_spec.rb
|
154
154
|
- bin/process_assets
|
155
155
|
- bin/process_taxonomy
|
156
156
|
- bin/process_availability
|
@@ -206,7 +206,6 @@ test_files:
|
|
206
206
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
207
207
|
- spec/dummy/config/locales/en.yml
|
208
208
|
- spec/dummy/db/test.sqlite3
|
209
|
-
- spec/dummy/log/development.log
|
210
209
|
- spec/dummy/log/test.log
|
211
210
|
- spec/dummy/public/404.html
|
212
211
|
- spec/dummy/public/422.html
|
@@ -230,4 +229,5 @@ test_files:
|
|
230
229
|
- spec/mock_data/taxonomy/taxonomy.xml
|
231
230
|
- spec/mock_data/taxonomy/taxonomyengine.yml
|
232
231
|
- spec/models/digital_asset_spec.rb
|
232
|
+
- spec/service/digital_asset_lookup_service_spec.rb
|
233
233
|
...
|
@@ -1,19 +0,0 @@
|
|
1
|
-
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
|
2
|
-
MONGODB (39ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
3
|
-
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
|
4
|
-
MONGODB (37ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
5
|
-
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
|
6
|
-
MONGODB (36ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
7
|
-
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
|
8
|
-
MONGODB (37ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
9
|
-
MONGODB (352ms) dummy_development['system.namespaces'].find({})
|
10
|
-
MONGODB (76ms) dummy_development['$cmd'].find({:create=>"digital_assets"}).limit(-1)
|
11
|
-
MONGODB (14ms) dummy_development['$cmd'].find({"count"=>"digital_assets", "query"=>{}, "fields"=>nil}).limit(-1)
|
12
|
-
MONGODB [DEBUG] Logging level is currently :debug which could negatively impact client-side performance. You should set your logging level no lower than :info in production.
|
13
|
-
MONGODB (71ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
14
|
-
MONGODB (284ms) dummy_development['system.namespaces'].find({})
|
15
|
-
MONGODB (51ms) dummy_development['$cmd'].find({:create=>"taxonomy_terms"}).limit(-1)
|
16
|
-
MONGODB (6ms) dummy_development['taxonomy_terms'].find({:"term_type.FUND_CODE"=>"foo"}).limit(-1).sort([[:_id, :asc]])
|
17
|
-
MONGODB (5ms) dummy_development['taxonomy_terms'].find({:"term_type.FUND_CODE"=>"735"}).limit(-1).sort([[:_id, :asc]])
|
18
|
-
MONGODB (13ms) dummy_development['$cmd'].find({"count"=>"taxonomy_terms", "query"=>{:term_type=>{"$exists"=>true}}, "fields"=>nil}).limit(-1)
|
19
|
-
MONGODB (5ms) dummy_development['taxonomy_terms'].find({}).limit(-1).sort([[:_id, :asc]])
|