daengine 0.0.5 → 0.0.6.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +17 -0
- data/bin/process_assets +17 -0
- data/lib/daengine.rb +2 -0
- data/lib/daengine/engine.rb +2 -0
- data/lib/daengine/version.rb +1 -1
- data/spec/controllers/digital_assets_controller_spec.rb +202 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +70 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/mongoid.yml +20 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +123 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories.rb +22 -0
- data/spec/lib/digital_asset_processor_spec.rb +16 -0
- data/spec/lib/teamsite_metadata_parser_spec.rb +60 -0
- data/spec/models/digital_asset_spec.rb +108 -0
- data/spec/spec_helper.rb +40 -0
- metadata +85 -10
File without changes
|
@@ -0,0 +1,123 @@
|
|
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 (57ms) admin['$cmd'].find({:ismaster=>1}).limit(-1)
|
3
|
+
MONGODB (22ms) dummy_test['system.namespaces'].find({})
|
4
|
+
MONGODB (23ms) dummy_test['system.namespaces'].find({})
|
5
|
+
MONGODB (11ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
6
|
+
Processing by DigitalAssetsController#index as HTML
|
7
|
+
Rendered c:/dev/workspaces/gem-workspace/daengine/app/views/digital_assets/index.html.erb within layouts/application (22.0ms)
|
8
|
+
Completed 200 OK in 104ms (Views: 102.0ms)
|
9
|
+
MONGODB (12ms) dummy_test['system.namespaces'].find({})
|
10
|
+
MONGODB (11ms) dummy_test['$cmd'].find({:create=>"digital_assets"}).limit(-1)
|
11
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-1", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-1", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/1/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-1-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
12
|
+
MONGODB (14ms) dummy_test['digital_assets'].find({})
|
13
|
+
MONGODB (22ms) dummy_test['system.namespaces'].find({})
|
14
|
+
MONGODB (30ms) dummy_test['system.namespaces'].find({})
|
15
|
+
MONGODB (10ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
16
|
+
MONGODB (4ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-2", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-2", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/2/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-2-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
17
|
+
Processing by DigitalAssetsController#show as HTML
|
18
|
+
Parameters: {"id"=>"guid-foobar-permanent-2"}
|
19
|
+
MONGODB (12ms) dummy_test['digital_assets'].find({:_id=>"guid-foobar-permanent-2"}).limit(-1).sort([[:_id, :asc]])
|
20
|
+
Completed 200 OK in 24ms (Views: 6.0ms)
|
21
|
+
MONGODB (22ms) dummy_test['system.namespaces'].find({})
|
22
|
+
MONGODB (22ms) dummy_test['system.namespaces'].find({})
|
23
|
+
MONGODB (10ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
24
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-3", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-3", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/3/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-3-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
25
|
+
Processing by DigitalAssetsController#show as HTML
|
26
|
+
Parameters: {"id"=>"F0000.BAR"}
|
27
|
+
MONGODB (12ms) dummy_test['digital_assets'].find({:sami_code=>"F0000.BAR"}).limit(-1).sort([[:changed_at, :desc]])
|
28
|
+
Completed 200 OK in 21ms (Views: 7.0ms)
|
29
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
30
|
+
MONGODB (19ms) dummy_test['system.namespaces'].find({})
|
31
|
+
MONGODB (10ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
32
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-4", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-4", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/4/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-4-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
33
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-5", "title"=>"Doc Title", "changed_at"=>2010-06-13 17:42:56 UTC, "guid"=>"guid-foobar-permanent-5", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/5/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-5-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
34
|
+
Processing by DigitalAssetsController#show as HTML
|
35
|
+
Parameters: {"id"=>"F0000.BAR"}
|
36
|
+
MONGODB (11ms) dummy_test['digital_assets'].find({:sami_code=>"F0000.BAR"}).limit(-1).sort([[:changed_at, :desc]])
|
37
|
+
Completed 200 OK in 17ms (Views: 3.0ms)
|
38
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
39
|
+
MONGODB (20ms) dummy_test['system.namespaces'].find({})
|
40
|
+
MONGODB (9ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
41
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-6", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-6", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:56 UTC, "created_at"=>2012-06-13 17:42:56 UTC, "documents"=>[{"path"=>"/6/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:56 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-6-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
42
|
+
Processing by DigitalAssetsController#show as HTML
|
43
|
+
Parameters: {"id"=>"guid-foobar-permanent-6"}
|
44
|
+
MONGODB (11ms) dummy_test['digital_assets'].find({:_id=>"guid-foobar-permanent-6"}).limit(-1).sort([[:_id, :asc]])
|
45
|
+
Completed 200 OK in 18ms (Views: 5.0ms)
|
46
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
47
|
+
MONGODB (19ms) dummy_test['system.namespaces'].find({})
|
48
|
+
MONGODB (15ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
49
|
+
Processing by DigitalAssetsController#search as HTML
|
50
|
+
Completed 200 OK in 8ms (Views: 7.0ms)
|
51
|
+
MONGODB (11ms) dummy_test['$cmd'].find({"count"=>"digital_assets", "query"=>{}, "fields"=>nil}).limit(-1)
|
52
|
+
MONGODB (16ms) dummy_test['system.namespaces'].find({})
|
53
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-7", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-7", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/7/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-7-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
54
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-8", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-8", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/8/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-8-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
55
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-9", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-9", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/9/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-9-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
56
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-10", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-10", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/10/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-10-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
57
|
+
MONGODB (3ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-11", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-11", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/11/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-11-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
58
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-12", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-12", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/12/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-12-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
59
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"guid-foobar-permanent-12"}, {"$unset"=>{"documents"=>true}})
|
60
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"guid-foobar-permanent-12"}, {"$pushAll"=>{"documents"=>[{"path"=>"/one/off.path", "doc_changed_at"=>2012-06-13 17:42:57 UTC, "content_type"=>"999", "_id"=>"-fwdslsh-one-fwdslsh-off-period-path"}]}})
|
61
|
+
Processing by DigitalAssetsController#search as HTML
|
62
|
+
Parameters: {"path"=>"/one/off.path"}
|
63
|
+
Completed 200 OK in 5ms (Views: 3.0ms)
|
64
|
+
MONGODB (13ms) dummy_test['digital_assets'].find({:"documents.path"=>"/one/off.path"})
|
65
|
+
MONGODB (12ms) dummy_test['digital_assets'].find({:"documents.path"=>"/one/off.path"})
|
66
|
+
MONGODB (10ms) dummy_test['$cmd'].find({"count"=>"digital_assets", "query"=>{:"documents.path"=>"/one/off.path"}, "fields"=>nil}).limit(-1)
|
67
|
+
MONGODB (12ms) dummy_test['digital_assets'].find({:"documents.path"=>"/one/off.path"}).limit(-1).sort([[:_id, :asc]])
|
68
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
69
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
70
|
+
MONGODB (11ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
71
|
+
MONGODB (14ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-13", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-13", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/13/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-13-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
72
|
+
MONGODB (15ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-14", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-14", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/14/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-14-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
73
|
+
MONGODB (2ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-15", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-15", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/15/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-15-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
74
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-16", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-16", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/16/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-16-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
75
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-17", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-17", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/17/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-17-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
76
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-18", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-18", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/18/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-18-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
77
|
+
MONGODB (0ms) dummy_test['digital_assets'].update({"_id"=>"guid-foobar-permanent-18"}, {"$unset"=>{"documents"=>true}})
|
78
|
+
MONGODB (0ms) dummy_test['digital_assets'].update({"_id"=>"guid-foobar-permanent-18"}, {"$pushAll"=>{"documents"=>[{"path"=>"/one/off.path", "doc_changed_at"=>2012-06-13 17:42:57 UTC, "content_type"=>"999", "_id"=>"-fwdslsh-one-fwdslsh-off-period-path"}]}})
|
79
|
+
MONGODB (20ms) dummy_test['system.namespaces'].find({})
|
80
|
+
MONGODB (22ms) dummy_test['system.namespaces'].find({})
|
81
|
+
MONGODB (10ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
82
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"some-new-asset-undscr-134", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"some-new-asset_134", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/19/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-19-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
83
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"some-new-asset-undscr-134"}, {"$unset"=>{"documents"=>true}})
|
84
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"some-new-asset-undscr-134"}, {"$push"=>{"documents"=>{"_id"=>"-fwdslsh-some-fwdslsh-crazy-fwdslsh-file-period-path", "path"=>"/some/crazy/file.path", "doc_changed_at"=>2012-06-11 17:42:55 UTC, "content_type"=>"777"}}})
|
85
|
+
Processing by DigitalAssetsController#search as HTML
|
86
|
+
Parameters: {"doctype"=>"666"}
|
87
|
+
Completed 200 OK in 4ms (Views: 3.0ms)
|
88
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-19", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-19", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/20/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-20-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
89
|
+
MONGODB (12ms) dummy_test['digital_assets'].find({:"documents.content_type"=>{"$in"=>["666"]}})
|
90
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
91
|
+
MONGODB (20ms) dummy_test['system.namespaces'].find({})
|
92
|
+
MONGODB (9ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
93
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"some-new-asset-undscr-134", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"some-new-asset_134", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/21/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-21-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
94
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"some-new-asset-undscr-134"}, {"$unset"=>{"documents"=>true}})
|
95
|
+
MONGODB (1ms) dummy_test['digital_assets'].update({"_id"=>"some-new-asset-undscr-134"}, {"$push"=>{"documents"=>{"_id"=>"-fwdslsh-some-fwdslsh-crazy-fwdslsh-file-period-path", "path"=>"/some/crazy/file.path", "doc_changed_at"=>2012-06-11 17:42:55 UTC, "content_type"=>"777"}}})
|
96
|
+
Processing by DigitalAssetsController#search as HTML
|
97
|
+
Parameters: {"doctype"=>["666", "777"]}
|
98
|
+
Completed 200 OK in 9ms (Views: 6.0ms)
|
99
|
+
MONGODB (10ms) dummy_test['digital_assets'].find({:"documents.content_type"=>{"$in"=>["666", "777"]}})
|
100
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-20", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-20", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:57 UTC, "created_at"=>2012-06-13 17:42:57 UTC, "documents"=>[{"path"=>"/22/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-22-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
101
|
+
MONGODB (16ms) dummy_test['digital_assets'].find({:"documents.content_type"=>{"$in"=>["666", "777"]}})
|
102
|
+
MONGODB (23ms) dummy_test['system.namespaces'].find({})
|
103
|
+
MONGODB (19ms) dummy_test['system.namespaces'].find({})
|
104
|
+
MONGODB (9ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
105
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-21", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-21", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"SOMETHING.001", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/23/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:57 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-23-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
106
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-22", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-22", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"SOMETHING.001", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/24/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-24-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
107
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["420"], "_id"=>"guid-foobar-permanent-23", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-23", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"SOMETHING.001", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/25/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-25-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
108
|
+
Processing by DigitalAssetsController#search as HTML
|
109
|
+
Parameters: {"sami"=>"SOMETHING.001"}
|
110
|
+
Completed 200 OK in 18ms (Views: 17.0ms)
|
111
|
+
MONGODB (10ms) dummy_test['$cmd'].find({"count"=>"digital_assets", "query"=>{:sami_code=>"SOMETHING.001"}, "fields"=>nil}).limit(-1)
|
112
|
+
MONGODB (21ms) dummy_test['system.namespaces'].find({})
|
113
|
+
MONGODB (36ms) dummy_test['system.namespaces'].find({})
|
114
|
+
MONGODB (12ms) dummy_test['$cmd'].find({:drop=>"digital_assets"}).limit(-1)
|
115
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["1234", "4567"], "_id"=>"guid-foobar-permanent-24", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-24", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/26/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-26-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
116
|
+
MONGODB (0ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["1234", "4567"], "_id"=>"guid-foobar-permanent-25", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-25", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/27/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-27-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
117
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["1234", "2323"], "_id"=>"guid-foobar-permanent-26", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-26", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/28/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-28-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
118
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["1234", "2323"], "_id"=>"guid-foobar-permanent-27", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-27", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/29/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-29-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
119
|
+
MONGODB (1ms) dummy_test['digital_assets'].insert([{"audiences"=>["490"], "product_ids"=>["690", "420"], "fund_ids"=>["9999"], "_id"=>"guid-foobar-permanent-28", "title"=>"Doc Title", "changed_at"=>2012-06-11 17:42:55 UTC, "guid"=>"guid-foobar-permanent-28", "published_at"=>2012-06-03 17:42:55 UTC, "expires_at"=>2012-08-13 17:42:55 UTC, "sami_code"=>"F0000.BAR", "business_owner"=>"biz owner", "updated_at"=>2012-06-13 17:42:58 UTC, "created_at"=>2012-06-13 17:42:58 UTC, "documents"=>[{"path"=>"/30/foo/bar.txt", "doc_changed_at"=>2012-06-11 17:42:58 UTC, "content_type"=>"666", "_id"=>"-fwdslsh-30-fwdslsh-foo-fwdslsh-bar-period-txt"}]}])
|
120
|
+
Processing by DigitalAssetsController#search as HTML
|
121
|
+
Parameters: {"funds"=>"1234"}
|
122
|
+
Completed 200 OK in 6ms (Views: 2.0ms)
|
123
|
+
MONGODB (10ms) dummy_test['$cmd'].find({"count"=>"digital_assets", "query"=>{:fund_ids=>{"$in"=>["1234"]}}, "fields"=>nil}).limit(-1)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
</div>
|
24
|
+
</body>
|
25
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env jruby.exe
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
data/spec/factories.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
|
3
|
+
factory :document, :class => 'DigitalAsset::Document' do
|
4
|
+
path '/some/crazy/file.path'
|
5
|
+
doc_changed_at 2.days.ago
|
6
|
+
content_type '777'
|
7
|
+
end
|
8
|
+
|
9
|
+
factory :digital_asset do
|
10
|
+
title 'Doc Title'
|
11
|
+
changed_at 2.days.ago
|
12
|
+
audiences ['490']
|
13
|
+
sequence(:guid) {|n| "guid-foobar-permanent-#{n}"}
|
14
|
+
published_at 10.days.ago
|
15
|
+
expires_at 2.months.from_now
|
16
|
+
fund_ids ['420']
|
17
|
+
sami_code 'F0000.BAR'
|
18
|
+
product_ids ['690', '420']
|
19
|
+
business_owner 'biz owner'
|
20
|
+
sequence(:documents) {|n|[DigitalAsset::Document.new(path: "/#{n}/foo/bar.txt", doc_changed_at: 2.days.ago, content_type: '666')]}
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Daengine::DigitalAssetProcessor do
|
4
|
+
before { Daengine.configure(:assets_path => 'c:/dev/rails/da_gem/spec/mock_data')}
|
5
|
+
context "process_tuple_directory" do
|
6
|
+
it 'processes only files modified in the last 2 days' do
|
7
|
+
# process all the files in the mock dir
|
8
|
+
expect { process_tuple_directory }.to change(DigitalAsset.count).by(1)
|
9
|
+
# modify the first 2 files in test-data directory to have updated times
|
10
|
+
FileUtils.touch '../mock_data/selective-ssc_2012_05_18_13_48_03_publish.xml'
|
11
|
+
# FileUtils.touch 'mock_data/selective-ssc_2012_05_18_13_56_18_unpublish.xml'
|
12
|
+
# re-process the updated files
|
13
|
+
expect { process_tuple_directory }.to change(DigitalAsset.count).by(1)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Daengine::TeamsiteMetadataParser do
|
4
|
+
|
5
|
+
subject { Daengine::TeamsiteMetadataParser }
|
6
|
+
|
7
|
+
context "#parse_tuple_file" do
|
8
|
+
it 'reads xml' do
|
9
|
+
# subject.logger= Logger.new(STDOUT)
|
10
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
11
|
+
expect {
|
12
|
+
subject.parse_tuple_file(open(file))
|
13
|
+
}.to change(DigitalAsset, :count).by(2)
|
14
|
+
entered = DigitalAsset.first
|
15
|
+
entered.id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
16
|
+
entered.documents[0].path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
17
|
+
entered.summary.should == 'first foo bar...'
|
18
|
+
DigitalAsset.first.documents.count.should eq(2)
|
19
|
+
end
|
20
|
+
it 'can read a whole bulk deploy xml file quickly' do
|
21
|
+
# subject.logger= Logger.new(STDOUT)
|
22
|
+
file = File.expand_path('./spec/mock_data/bulk-ssc_deploy.xml')
|
23
|
+
open_file = open(file, 'rb')
|
24
|
+
expect {
|
25
|
+
subject.parse_tuple_file(open_file)
|
26
|
+
}.to change(DigitalAsset, :count).by(1588)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
context 'deleting paths' do
|
32
|
+
before do
|
33
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
34
|
+
subject.parse_tuple_file(open(file))
|
35
|
+
end
|
36
|
+
it 'deletes paths that are no-longer in the tuples for a package' do
|
37
|
+
file = File.expand_path('./spec/mock_data/selective_path_delete_from_package.xml')
|
38
|
+
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(2).items
|
39
|
+
expect {
|
40
|
+
subject.parse_tuple_file(open(file))
|
41
|
+
}.to change(DigitalAsset, :count).by(0)
|
42
|
+
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(1).item
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'remove unpublished documents from mongo' do
|
47
|
+
before do
|
48
|
+
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_48_03_publish.xml')
|
49
|
+
subject.parse_tuple_file(open(file))
|
50
|
+
end
|
51
|
+
it 'removes package records from mongo that are in unpublished state' do
|
52
|
+
DigitalAsset.find('11570991-9887-46df-8c47-d0870e6b5008').documents.should have(1).item
|
53
|
+
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_56_18_unpublish.xml')
|
54
|
+
expect {
|
55
|
+
subject.parse_tuple_file(open(file))
|
56
|
+
}.to change(DigitalAsset, :count).by(-1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DigitalAsset do
|
4
|
+
|
5
|
+
subject { FactoryGirl.build :digital_asset }
|
6
|
+
|
7
|
+
context '#fields' do
|
8
|
+
let(:defined_fields) {
|
9
|
+
[:title, :changed_at, :sami_code, :product_ids, :summary,
|
10
|
+
:published_at, :expires_at, :documents, :guid, :fund_ids, :audiences]
|
11
|
+
}
|
12
|
+
it 'has all defined fields' do
|
13
|
+
defined_fields.each {|f| should respond_to(f)}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context '#validation' do
|
18
|
+
required_fields = [:guid, :title, :changed_at, :published_at, :expires_at]
|
19
|
+
required_fields.each do |f|
|
20
|
+
it "validates #{f} is required" do
|
21
|
+
should be_valid
|
22
|
+
subject.send("#{f}=", nil)
|
23
|
+
should be_invalid "should be invalid if #{f} is missing"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
it 'must have at least one document' do
|
27
|
+
subject.documents.clear
|
28
|
+
subject.should be_invalid
|
29
|
+
end
|
30
|
+
it 'cannot have a past expiration date' do
|
31
|
+
subject.expires_at = 2.hours.ago
|
32
|
+
subject.should be_invalid
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context '#documents' do
|
37
|
+
let(:manifest) { FactoryGirl.build :document, :path => '/foo/manifest/foo.doc'}
|
38
|
+
it 'doesnt add manifest documents' do
|
39
|
+
subject.documents << manifest
|
40
|
+
subject.save.should be_false
|
41
|
+
# DigitalAsset.find(subject.id).documents should have(1).document
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "purge!" do
|
46
|
+
before do
|
47
|
+
50.times { FactoryGirl.create :digital_asset }
|
48
|
+
FactoryGirl.create :digital_asset, :updated_at => 10.minutes.ago
|
49
|
+
end
|
50
|
+
it 'removes all assets more than 5 minutes stale if bulk file has been processed' do
|
51
|
+
expect {
|
52
|
+
DigitalAsset.purge!
|
53
|
+
}.to change(DigitalAsset, :count).by(-1)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
context '#finders' do
|
59
|
+
before do
|
60
|
+
@asset = FactoryGirl.create :digital_asset, :fund_ids => ['303'],
|
61
|
+
:audiences => ['690'], :sami_code => 'F000000.BAR'
|
62
|
+
FactoryGirl.create :digital_asset, :fund_ids => ['420'],
|
63
|
+
:sami_code => 'MEH12345.000', :updated_at => 1.hour.ago
|
64
|
+
end
|
65
|
+
it 'has a finder by fund_id' do
|
66
|
+
DigitalAsset.should respond_to(:funds_in)
|
67
|
+
DigitalAsset.funds_in(['303']).should have(1).digital_asset
|
68
|
+
DigitalAsset.funds_in(['808']).should have(0).digital_assets
|
69
|
+
end
|
70
|
+
it 'has a finder by product_id' do
|
71
|
+
DigitalAsset.should respond_to(:product_in)
|
72
|
+
DigitalAsset.product_in(['690']).should have(2).digital_asset
|
73
|
+
end
|
74
|
+
it 'has a finder by sami_code' do
|
75
|
+
DigitalAsset.should respond_to(:sami_is)
|
76
|
+
DigitalAsset.sami_is('F000000.BAR').should have(1).digital_asset
|
77
|
+
end
|
78
|
+
it 'has a finder by the embedded doc path' do
|
79
|
+
DigitalAsset.should respond_to(:path_is)
|
80
|
+
DigitalAsset.path_is(@asset.documents.first.path).should have(1).digital_asset
|
81
|
+
end
|
82
|
+
it 'has a type finder for the documents' do
|
83
|
+
DigitalAsset.should respond_to(:doctype_in)
|
84
|
+
DigitalAsset.doctype_in(['666']).should have(2).digital_asset
|
85
|
+
end
|
86
|
+
it 'can chain finders together' do
|
87
|
+
FactoryGirl.create :digital_asset, :fund_ids => ['999'],
|
88
|
+
:audiences => ['420'], :sami_code => 'F000000.BAR'
|
89
|
+
DigitalAsset.funds_in(['303', '420']).should have(2).digital_asset
|
90
|
+
DigitalAsset.funds_in(['303', '420']).audience_in(['690']).should have(1).digital_asset
|
91
|
+
end
|
92
|
+
it 'has a finder for stale documents' do
|
93
|
+
DigitalAsset.should respond_to(:stale)
|
94
|
+
DigitalAsset.stale.should have(1).item
|
95
|
+
end
|
96
|
+
it 'has a method that tells you if the bulk-file processing is working' do
|
97
|
+
DigitalAsset.should respond_to(:bulk_processed?)
|
98
|
+
2.times { FactoryGirl.create :digital_asset }
|
99
|
+
2.times { FactoryGirl.create :digital_asset, :updated_at => 10.minutes.ago }
|
100
|
+
DigitalAsset.count.should == 6
|
101
|
+
DigitalAsset.stale.count.should == 3
|
102
|
+
DigitalAsset.should_not be_bulk_processed
|
103
|
+
54.times { FactoryGirl.create :digital_asset }
|
104
|
+
DigitalAsset.should be_bulk_processed
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
3
|
+
# require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
require 'factory_girl'
|
7
|
+
# require 'rspec/autorun'
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
12
|
+
|
13
|
+
require File.expand_path('../factories.rb', __FILE__)
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
# ## Mock Framework
|
17
|
+
#
|
18
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
19
|
+
#
|
20
|
+
# config.mock_with :mocha
|
21
|
+
# config.mock_with :flexmock
|
22
|
+
# config.mock_with :rr
|
23
|
+
|
24
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
25
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
26
|
+
|
27
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
28
|
+
# examples within a transaction, remove the following line or assign false
|
29
|
+
# instead of true.
|
30
|
+
# config.use_transactional_fixtures = true
|
31
|
+
|
32
|
+
config.before(:each) do
|
33
|
+
Mongoid.purge!
|
34
|
+
end
|
35
|
+
|
36
|
+
# If true, the base class of anonymous controllers will be inferred
|
37
|
+
# automatically. This will be the default behavior in future versions of
|
38
|
+
# rspec-rails.
|
39
|
+
config.infer_base_class_for_anonymous_controllers = false
|
40
|
+
end
|