couch_potato 1.19.0 → 1.19.1
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.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/lib/couch_potato/version.rb +1 -1
- data/lib/couch_potato/view/view_query.rb +3 -0
- data/spec/unit/view_query_spec.rb +25 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc35d2d68e09d52bac2dec8d876e6cc0173bc4f0959c3ecff6d35483791553d
|
4
|
+
data.tar.gz: 0a7f6752cb79df5f1a9f6bb7a4a5252df570ddc82f4632ac21c6b6daf919263e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c42c9fbc4f3401e117c29fbbe7c78df593124dce08d50471b210f9b7dfb7aa5e9f6923935d96e3cb6a8fffff2e565a2fd36ab4fe935b1c492a0b7f7fb8a4159
|
7
|
+
data.tar.gz: e6e43661a6e9d4c1e2d89751a2560e5cbb4fe6b311643d438e64c7c40b243b208b859c711537f1ae105bf0777185769b294c48a6f70816a9b78b4592e79f65f8
|
data/CHANGES.md
CHANGED
data/lib/couch_potato/version.rb
CHANGED
@@ -41,6 +41,9 @@ module CouchPotato
|
|
41
41
|
design_doc ||= empty_design_document
|
42
42
|
if CouchPotato::Config.single_design_document
|
43
43
|
design_doc['views'] = all_views
|
44
|
+
if CouchPotato::Config.digest_view_names
|
45
|
+
design_doc['_id'] = "_design/#{@design_document_name}-#{Digest::SHA256.hexdigest(design_doc['views'].to_json)}"
|
46
|
+
end
|
44
47
|
else
|
45
48
|
design_doc['views'][@view_name.to_s] = view_functions
|
46
49
|
end
|
@@ -8,6 +8,11 @@ describe CouchPotato::View::ViewQuery, 'query_view!' do
|
|
8
8
|
CouchPotato::View::ViewQuery.clear_cache
|
9
9
|
end
|
10
10
|
|
11
|
+
after(:each) do
|
12
|
+
CouchPotato::Config.single_design_document = false
|
13
|
+
CouchPotato::Config.digest_view_names = false
|
14
|
+
end
|
15
|
+
|
11
16
|
it 'does not pass a key if conditions are empty' do
|
12
17
|
expect(db).to receive(:view).with(anything, {})
|
13
18
|
CouchPotato::View::ViewQuery.new(db, '', {:view0 => {}}).query_view!
|
@@ -81,4 +86,23 @@ describe CouchPotato::View::ViewQuery, 'query_view!' do
|
|
81
86
|
expect(db).to receive(:save_doc)
|
82
87
|
CouchPotato::View::ViewQuery.new(db, 'design', :view8 => {:map => '<map_code>', :reduce => '<new reduce_code>'}).query_view!
|
83
88
|
end
|
84
|
-
|
89
|
+
|
90
|
+
it 'adds a digest of all views to the design document if single_design_doc is true' do
|
91
|
+
CouchPotato::Config.single_design_document = true
|
92
|
+
CouchPotato::Config.digest_view_names = true
|
93
|
+
|
94
|
+
allow(db).to receive(:get).and_return(nil)
|
95
|
+
allow(db).to receive(:save_doc).and_return(true)
|
96
|
+
view_class = double('view_class',
|
97
|
+
views: {view: {map: '<map_code>'}},
|
98
|
+
execute_view: double('view_spec', view_name: 'view', map_function: '<map_code>', reduce_function: nil))
|
99
|
+
allow(CouchPotato).to receive(:views).and_return([view_class])
|
100
|
+
|
101
|
+
CouchPotato::View::ViewQuery.new(
|
102
|
+
db,
|
103
|
+
'couch_potato',
|
104
|
+
{:view => {:map => '<map_code>'}}).query_view!
|
105
|
+
|
106
|
+
expect(db).to have_received(:save_doc).with(hash_including({"_id" => "_design/couch_potato-56d286b4f0cd3a50fdd2ad428034d08a6483311539f7e138c45e781611b9dbbc"}))
|
107
|
+
end
|
108
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couch_potato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.19.
|
4
|
+
version: 1.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Lang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|