couch_potato 1.12.1 → 1.14.0
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/.github/workflows/ruby.yml +2 -7
- data/.gitignore +1 -0
- data/CHANGES.md +11 -0
- data/Rakefile +2 -2
- data/couch_potato-rspec.gemspec +1 -1
- data/couch_potato.gemspec +2 -2
- data/gemfiles/active_support_7_0 +1 -1
- data/gemfiles/{active_support_6_1 → active_support_7_1} +1 -1
- data/lib/couch_potato/database.rb +2 -0
- data/lib/couch_potato/persistence/properties.rb +5 -1
- data/lib/couch_potato/persistence/simple_property.rb +2 -1
- data/lib/couch_potato/persistence/type_caster.rb +1 -1
- data/lib/couch_potato/persistence.rb +1 -1
- data/lib/couch_potato/version.rb +2 -2
- data/lib/couch_potato/view/flex_view_spec.rb +2 -0
- data/lib/couch_potato.rb +1 -1
- data/spec/create_spec.rb +13 -3
- data/spec/unit/attributes_spec.rb +5 -57
- data/spec/unit/database_spec.rb +55 -8
- data/spec/unit/flex_view_spec_spec.rb +27 -0
- metadata +8 -9
- data/gemfiles/active_support_6_0 +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd4dede2152745db1f3f0bf7ff3a94dfea3c7eb427beb02292034866dd7dac22
|
4
|
+
data.tar.gz: 29ca77512b6bdeebcdd31847deac4957792946519dda4f658f60dd90c9dd83e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21728691cd7eb4b23bd6600899655cc7fa1dbb6a15a6d40c669b53941fab30bf38cb8a95fa9a3e8f85e05d44af116f58cd20a424eedd60d417972db893c07aff
|
7
|
+
data.tar.gz: d2d26373afd0bcce487b35703be3bd7bd08cc7e4e108f98e8279bf81c41715b30f5590fdf8080c4b136ec95e356c857b5c50bef123b6971e67294e79cdeb180a
|
data/.github/workflows/ruby.yml
CHANGED
@@ -16,18 +16,13 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [
|
19
|
+
ruby: ["3.0", "3.1", "3.2", "jruby"]
|
20
20
|
gemfile:
|
21
|
-
- "active_support_6_0"
|
22
|
-
- "active_support_6_1"
|
23
21
|
- "active_support_7_0"
|
22
|
+
- "active_support_7_1"
|
24
23
|
exclude:
|
25
24
|
- ruby: "jruby"
|
26
25
|
gemfile: "active_support_7_0"
|
27
|
-
- ruby: "3.0"
|
28
|
-
gemfile: "active_support_6_0"
|
29
|
-
- ruby: "3.1"
|
30
|
-
gemfile: "active_support_6_0"
|
31
26
|
steps:
|
32
27
|
- uses: actions/checkout@v2
|
33
28
|
- name: Set up CouchDB
|
data/.gitignore
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
## Changes
|
2
2
|
|
3
|
+
# 1.14.0
|
4
|
+
|
5
|
+
- add database_collection to models to help avoid n+1 requests
|
6
|
+
|
7
|
+
# 1.13.0
|
8
|
+
|
9
|
+
- add Ruby 3.2 support
|
10
|
+
- remove Ruby 2.7 support
|
11
|
+
- add active_support 7.1 support
|
12
|
+
- remove active_support 6.x support
|
13
|
+
|
3
14
|
# 1.12.1
|
4
15
|
|
5
16
|
- re-enable aliases when parsing config yaml file
|
data/Rakefile
CHANGED
@@ -26,8 +26,8 @@ end
|
|
26
26
|
|
27
27
|
desc 'Run all specs for all gemfiles'
|
28
28
|
task :spec do
|
29
|
-
%w(7_0
|
30
|
-
Bundler.
|
29
|
+
%w(7_1 7_0).each do |version|
|
30
|
+
Bundler.with_original_env do
|
31
31
|
puts "Running tests with ActiveSupport #{version.sub('_', '.')}"
|
32
32
|
sh "env BUNDLE_GEMFILE=gemfiles/active_support_#{version} bundle install"
|
33
33
|
sh "env BUNDLE_GEMFILE=gemfiles/active_support_#{version} bundle exec rake spec_unit spec_functional"
|
data/couch_potato-rspec.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.version = CouchPotato::RSPEC_VERSION
|
12
12
|
s.platform = Gem::Platform::RUBY
|
13
13
|
|
14
|
-
s.add_dependency 'rspec', '~>3.
|
14
|
+
s.add_dependency 'rspec', '~>3.12'
|
15
15
|
s.add_development_dependency 'rake'
|
16
16
|
s.add_dependency 'execjs', '~>2.7'
|
17
17
|
|
data/couch_potato.gemspec
CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.version = CouchPotato::VERSION
|
14
14
|
s.platform = Gem::Platform::RUBY
|
15
15
|
|
16
|
-
s.add_dependency 'activemodel', ['>= 5.0', '<
|
16
|
+
s.add_dependency 'activemodel', ['>= 5.0', '< 8.0']
|
17
17
|
s.add_dependency 'couchrest', '~>2.0.0'
|
18
18
|
s.add_dependency 'json', '~> 2.3'
|
19
19
|
|
20
20
|
s.add_development_dependency 'rake', '~>12.0'
|
21
|
-
s.add_development_dependency 'rspec', '~>3.
|
21
|
+
s.add_development_dependency 'rspec', '~>3.12.0'
|
22
22
|
s.add_development_dependency 'timecop'
|
23
23
|
s.add_development_dependency 'tzinfo'
|
24
24
|
|
data/gemfiles/active_support_7_0
CHANGED
@@ -224,6 +224,7 @@ module CouchPotato
|
|
224
224
|
elsif processed_results.respond_to?(:each)
|
225
225
|
processed_results.each do |document|
|
226
226
|
document.database = self if document.respond_to?(:database=)
|
227
|
+
document.database_collection = processed_results if document.respond_to?(:database_collection=)
|
227
228
|
end
|
228
229
|
end
|
229
230
|
processed_results
|
@@ -297,6 +298,7 @@ module CouchPotato
|
|
297
298
|
docs = response['rows'].map { |row| row['doc'] }.compact
|
298
299
|
docs.each do |doc|
|
299
300
|
doc.database = self if doc.respond_to?(:database=)
|
301
|
+
doc.database_collection = docs if doc.respond_to?(:database_collection=)
|
300
302
|
end
|
301
303
|
end
|
302
304
|
|
@@ -93,7 +93,11 @@ module CouchPotato
|
|
93
93
|
active_support_module.module_eval do
|
94
94
|
undef_method(name) if instance_methods.include?(name)
|
95
95
|
end
|
96
|
-
cache =
|
96
|
+
cache = if respond_to?(:attribute_method_matchers_cache, true) # activemodel 7.0
|
97
|
+
send(:attribute_method_matchers_cache)
|
98
|
+
else # activemodel 7.1
|
99
|
+
send(:attribute_method_patterns_cache)
|
100
|
+
end
|
97
101
|
cache.delete(name)
|
98
102
|
|
99
103
|
define_attribute_method name
|
@@ -15,12 +15,13 @@ module CouchPotato
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class SimpleProperty #:nodoc:
|
18
|
-
attr_accessor :name, :type
|
18
|
+
attr_accessor :name, :type, :default_value
|
19
19
|
|
20
20
|
def initialize(owner_clazz, name, options = {})
|
21
21
|
self.name = name
|
22
22
|
@setter_name = "#{name}="
|
23
23
|
self.type = options[:type]
|
24
|
+
self.default_value = options[:default]
|
24
25
|
@type_caster = TypeCaster.new
|
25
26
|
owner_clazz.send :include, PropertyMethods unless owner_clazz.ancestors.include?(PropertyMethods)
|
26
27
|
|
@@ -32,7 +32,7 @@ module CouchPotato
|
|
32
32
|
def cast_native(value, type)
|
33
33
|
if type && !value.is_a?(type)
|
34
34
|
|
35
|
-
if %w[Integer Bignum
|
35
|
+
if %w[Integer Bignum].include?(type.to_s)
|
36
36
|
value.to_s.scan(NUMBER_REGEX).join.to_d.round unless value.blank?
|
37
37
|
elsif type == Float
|
38
38
|
value.to_s.scan(NUMBER_REGEX).join.to_f unless value.blank?
|
@@ -27,7 +27,7 @@ module CouchPotato
|
|
27
27
|
ForbiddenAttributesProtection, Revisions
|
28
28
|
base.send :include, Validation
|
29
29
|
base.class_eval do
|
30
|
-
attr_accessor :_id, :_rev, :_deleted, :database
|
30
|
+
attr_accessor :_id, :_rev, :_deleted, :database, :database_collection
|
31
31
|
alias_method :id, :_id
|
32
32
|
alias_method :id=, :_id=
|
33
33
|
|
data/lib/couch_potato/version.rb
CHANGED
@@ -73,9 +73,11 @@ module CouchPotato
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def docs
|
76
|
+
all_docs = rows.map { |r| r['doc'] }
|
76
77
|
rows.map do |row|
|
77
78
|
doc = row['doc']
|
78
79
|
doc.database = database if doc.respond_to?(:database=)
|
80
|
+
doc.database_collection = all_docs if doc.respond_to?(:database_collection=)
|
79
81
|
doc
|
80
82
|
end
|
81
83
|
end
|
data/lib/couch_potato.rb
CHANGED
@@ -54,7 +54,7 @@ module CouchPotato
|
|
54
54
|
def self.use(database_name)
|
55
55
|
resolved_database_name = resolve_database_name(database_name)
|
56
56
|
Thread.current[:__couch_potato_databases] ||= {}
|
57
|
-
Thread.current[:__couch_potato_databases][resolved_database_name] ||= Database.new(couchrest_database_for_name
|
57
|
+
Thread.current[:__couch_potato_databases][resolved_database_name] ||= Database.new(couchrest_database_for_name(resolved_database_name), name: database_name)
|
58
58
|
end
|
59
59
|
|
60
60
|
# resolves a name to a database name/full url configured under additional databases
|
data/spec/create_spec.rb
CHANGED
@@ -34,14 +34,24 @@ describe "create" do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "multi-db" do
|
37
|
-
|
37
|
+
let(:test_dbs) do
|
38
|
+
['comment_a', 'comment_b', 'comment_c'].map do |name|
|
39
|
+
if ENV['DATABASE']
|
40
|
+
uri = URI.parse(ENV['DATABASE'])
|
41
|
+
uri.path = "/#{name}"
|
42
|
+
uri.to_s
|
43
|
+
else
|
44
|
+
name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
38
48
|
|
39
49
|
before(:each) do
|
40
|
-
|
50
|
+
test_dbs.each { |db_name| CouchPotato.couchrest_database_for_name(db_name).recreate! }
|
41
51
|
end
|
42
52
|
|
43
53
|
it "should create documents in multiple dbs" do
|
44
|
-
|
54
|
+
test_dbs.each do |db_name|
|
45
55
|
@comment = Comment.new(:title => 'my_title')
|
46
56
|
CouchPotato.with_database(db_name) do |couch|
|
47
57
|
couch.save_document! @comment
|
@@ -9,7 +9,6 @@ end
|
|
9
9
|
class Plant
|
10
10
|
include CouchPotato::Persistence
|
11
11
|
property :leaf_count
|
12
|
-
property :typed_leaf_count, type: Fixnum
|
13
12
|
property :integer_something, type: Integer
|
14
13
|
property :typed_leaf_size, type: Float
|
15
14
|
property :branch, type: Branch
|
@@ -42,7 +41,7 @@ describe 'attributes' do
|
|
42
41
|
|
43
42
|
expect(plant.attributes).to eq('leaf_count' => 1, 'created_at' => nil,
|
44
43
|
'integer_something' => nil,
|
45
|
-
'updated_at' => nil,
|
44
|
+
'updated_at' => nil,
|
46
45
|
'typed_leaf_size' => nil, 'branch' => nil)
|
47
46
|
end
|
48
47
|
|
@@ -112,25 +111,25 @@ describe 'attributes' do
|
|
112
111
|
end
|
113
112
|
|
114
113
|
describe 'integer' do
|
115
|
-
it 'rounds a float to
|
114
|
+
it 'rounds a float to an integer' do
|
116
115
|
@plant.integer_something = 4.5
|
117
116
|
|
118
117
|
expect(@plant.integer_something).to eq(5)
|
119
118
|
end
|
120
119
|
|
121
|
-
it 'converts a string into
|
120
|
+
it 'converts a string into an integer' do
|
122
121
|
@plant.integer_something = '4'
|
123
122
|
|
124
123
|
expect(@plant.integer_something).to eq(4)
|
125
124
|
end
|
126
125
|
|
127
|
-
it 'converts a string into a negative
|
126
|
+
it 'converts a string into a negative integer' do
|
128
127
|
@plant.integer_something = '-4'
|
129
128
|
|
130
129
|
expect(@plant.integer_something).to eq(-4)
|
131
130
|
end
|
132
131
|
|
133
|
-
it 'leaves
|
132
|
+
it 'leaves an integer as is' do
|
134
133
|
@plant.integer_something = 4
|
135
134
|
|
136
135
|
expect(@plant.integer_something).to eq(4)
|
@@ -161,57 +160,6 @@ describe 'attributes' do
|
|
161
160
|
end
|
162
161
|
end
|
163
162
|
|
164
|
-
|
165
|
-
describe 'fixnum' do
|
166
|
-
it 'rounds a float to a fixnum' do
|
167
|
-
@plant.typed_leaf_count = 4.5
|
168
|
-
|
169
|
-
expect(@plant.typed_leaf_count).to eq(5)
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'converts a string into a fixnum' do
|
173
|
-
@plant.typed_leaf_count = '4'
|
174
|
-
|
175
|
-
expect(@plant.typed_leaf_count).to eq(4)
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'converts a string into a negative fixnum' do
|
179
|
-
@plant.typed_leaf_count = '-4'
|
180
|
-
|
181
|
-
expect(@plant.typed_leaf_count).to eq(-4)
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'leaves a fixnum as is' do
|
185
|
-
@plant.typed_leaf_count = 4
|
186
|
-
|
187
|
-
expect(@plant.typed_leaf_count).to eq(4)
|
188
|
-
end
|
189
|
-
|
190
|
-
it 'leaves nil as is' do
|
191
|
-
@plant.typed_leaf_count = nil
|
192
|
-
|
193
|
-
expect(@plant.typed_leaf_count).to be_nil
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'sets the attributes to zero if a string given' do
|
197
|
-
@plant.typed_leaf_count = 'x'
|
198
|
-
|
199
|
-
expect(@plant.typed_leaf_count).to eq(0)
|
200
|
-
end
|
201
|
-
|
202
|
-
it 'parses numbers out of a string' do
|
203
|
-
@plant.typed_leaf_count = 'x123'
|
204
|
-
|
205
|
-
expect(@plant.typed_leaf_count).to eq(123)
|
206
|
-
end
|
207
|
-
|
208
|
-
it 'sets the attributes to nil if given a blank string' do
|
209
|
-
@plant.typed_leaf_count = ''
|
210
|
-
|
211
|
-
expect(@plant.typed_leaf_count).to be_nil
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
163
|
context 'float' do
|
216
164
|
it 'converts a number in a string with a decimal place' do
|
217
165
|
@plant.typed_leaf_size = '0.5001'
|
data/spec/unit/database_spec.rb
CHANGED
@@ -56,6 +56,16 @@ describe CouchPotato::Database, 'load' do
|
|
56
56
|
db.load '1'
|
57
57
|
end
|
58
58
|
|
59
|
+
it 'does not set database_collection on the model' do
|
60
|
+
user = double('user', 'database_collection=': nil).as_null_object
|
61
|
+
allow(DbTestUser).to receive(:new).and_return(user)
|
62
|
+
allow(couchrest_db).to receive(:get).and_return DbTestUser.json_create({ JSON.create_id => 'DbTestUser' })
|
63
|
+
|
64
|
+
db.load '1'
|
65
|
+
|
66
|
+
expect(user).not_to have_received(:database_collection=).with(db)
|
67
|
+
end
|
68
|
+
|
59
69
|
it 'should load namespaced models' do
|
60
70
|
allow(couchrest_db).to receive(:get).and_return Parent::Child.json_create({ JSON.create_id => 'Parent::Child' })
|
61
71
|
expect(db.load('1').class).to eq(Parent::Child)
|
@@ -89,7 +99,7 @@ describe CouchPotato::Database, 'load' do
|
|
89
99
|
|
90
100
|
it 'does not write itself to a document that has no database= method' do
|
91
101
|
doc1 = double(:doc1)
|
92
|
-
allow(doc1).to receive(:respond_to?)
|
102
|
+
allow(doc1).to receive(:respond_to?) { false }
|
93
103
|
allow(couchrest_db).to receive(:bulk_load) do
|
94
104
|
{ 'rows' => [{ 'doc' => doc1 }] }
|
95
105
|
end
|
@@ -99,6 +109,24 @@ describe CouchPotato::Database, 'load' do
|
|
99
109
|
db.load(['1'])
|
100
110
|
end
|
101
111
|
|
112
|
+
it 'sets database_collection on each of the documents' do
|
113
|
+
db.load(%w[1 2]).each do |doc|
|
114
|
+
expect(doc.database_collection).to eql([doc1, doc2])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'does not set database_collection on a document that has no database_collection= method' do
|
119
|
+
doc1 = double(:doc1)
|
120
|
+
allow(doc1).to receive(:respond_to?) { false }
|
121
|
+
allow(couchrest_db).to receive(:bulk_load) do
|
122
|
+
{ 'rows' => [{ 'doc' => doc1 }] }
|
123
|
+
end
|
124
|
+
|
125
|
+
expect(doc1).not_to receive(:database_collection=)
|
126
|
+
|
127
|
+
db.load(['1'])
|
128
|
+
end
|
129
|
+
|
102
130
|
it 'returns an empty array when passing an empty array' do
|
103
131
|
expect(db.load([])).to eq([])
|
104
132
|
end
|
@@ -336,7 +364,7 @@ describe CouchPotato::Database, 'view' do
|
|
336
364
|
allow(CouchPotato::View::ViewQuery).to receive_messages(new: double('view query', query_view!: { 'rows' => [@result] }))
|
337
365
|
end
|
338
366
|
|
339
|
-
it '
|
367
|
+
it 'initializes a view query with map/reduce/list/lib funtions' do
|
340
368
|
allow(@spec).to receive_messages(design_document: 'design_doc', view_name: 'my_view',
|
341
369
|
map_function: '<map_code>', reduce_function: '<reduce_code>',
|
342
370
|
lib: { test: '<test_code>' },
|
@@ -355,7 +383,7 @@ describe CouchPotato::Database, 'view' do
|
|
355
383
|
@db.view(@spec)
|
356
384
|
end
|
357
385
|
|
358
|
-
it '
|
386
|
+
it 'initializes a view query with map/reduce/list funtions' do
|
359
387
|
allow(@spec).to receive_messages(design_document: 'design_doc', view_name: 'my_view',
|
360
388
|
map_function: '<map_code>', reduce_function: '<reduce_code>',
|
361
389
|
lib: nil, list_name: 'my_list', list_function: '<list_code>',
|
@@ -374,7 +402,7 @@ describe CouchPotato::Database, 'view' do
|
|
374
402
|
@db.view(@spec)
|
375
403
|
end
|
376
404
|
|
377
|
-
it '
|
405
|
+
it 'initializes a view query with only map/reduce/lib functions' do
|
378
406
|
allow(@spec).to receive_messages(design_document: 'design_doc', view_name: 'my_view',
|
379
407
|
map_function: '<map_code>', reduce_function: '<reduce_code>',
|
380
408
|
list_name: nil, list_function: nil,
|
@@ -390,7 +418,7 @@ describe CouchPotato::Database, 'view' do
|
|
390
418
|
@db.view(@spec)
|
391
419
|
end
|
392
420
|
|
393
|
-
it '
|
421
|
+
it 'initializes a view query with only map/reduce functions' do
|
394
422
|
allow(@spec).to receive_messages(design_document: 'design_doc', view_name: 'my_view',
|
395
423
|
map_function: '<map_code>', reduce_function: '<reduce_code>',
|
396
424
|
lib: nil, list_name: nil, list_function: nil)
|
@@ -405,18 +433,37 @@ describe CouchPotato::Database, 'view' do
|
|
405
433
|
@db.view(@spec)
|
406
434
|
end
|
407
435
|
|
408
|
-
it 'sets itself on returned
|
436
|
+
it 'sets itself on returned docs that have an accessor' do
|
437
|
+
allow(@result).to receive(:respond_to?).and_return(false)
|
409
438
|
allow(@result).to receive(:respond_to?).with(:database=).and_return(true)
|
410
439
|
expect(@result).to receive(:database=).with(@db)
|
411
440
|
@db.view(@spec)
|
412
441
|
end
|
413
442
|
|
414
|
-
it "does not set itself on returned
|
415
|
-
allow(@result).to receive(:respond_to?).
|
443
|
+
it "does not set itself on returned docs that don't have an accessor" do
|
444
|
+
allow(@result).to receive(:respond_to?).and_return(false)
|
416
445
|
expect(@result).not_to receive(:database=).with(@db)
|
417
446
|
@db.view(@spec)
|
418
447
|
end
|
419
448
|
|
449
|
+
it 'sets the result of the view call on each returned doc' do
|
450
|
+
allow(@result).to receive(:respond_to?).and_return(false)
|
451
|
+
allow(@result).to receive(:respond_to?).with(:database_collection=).and_return(true)
|
452
|
+
allow(@result).to receive(:database_collection=)
|
453
|
+
|
454
|
+
@db.view(@spec)
|
455
|
+
|
456
|
+
expect(@result).to have_received(:database_collection=).with([@result])
|
457
|
+
end
|
458
|
+
|
459
|
+
it "does not set the result of the view call on docs that don't have an accessor" do
|
460
|
+
allow(@result).to receive(:respond_to?).and_return(false)
|
461
|
+
|
462
|
+
@db.view(@spec)
|
463
|
+
|
464
|
+
expect(@result).not_to receive(:database_collection=).with([@result])
|
465
|
+
end
|
466
|
+
|
420
467
|
it 'does not try to set itself on result sets that are not collections' do
|
421
468
|
expect do
|
422
469
|
allow(@spec).to receive_messages(process_results: 1)
|
@@ -15,3 +15,30 @@ RSpec.describe CouchPotato::View::FlexViewSpec::Results, '#reduce_count' do
|
|
15
15
|
expect(result.reduce_count).to eq(0)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
RSpec.describe CouchPotato::View::FlexViewSpec::Results, '#docs' do
|
20
|
+
it 'sets the database on each doc' do
|
21
|
+
db = double('db')
|
22
|
+
doc = double('doc', 'database=': nil)
|
23
|
+
|
24
|
+
result = CouchPotato::View::FlexViewSpec::Results.new 'rows' => [{ 'doc' => doc }]
|
25
|
+
result.database = db
|
26
|
+
|
27
|
+
result.docs
|
28
|
+
|
29
|
+
expect(doc).to have_received(:database=).with(db)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'sets all docs as database_collection on each doc' do
|
33
|
+
doc = double('doc', 'database_collection=': nil)
|
34
|
+
|
35
|
+
result = CouchPotato::View::FlexViewSpec::Results.new 'rows' => [{ 'doc' => doc }]
|
36
|
+
|
37
|
+
result.docs
|
38
|
+
|
39
|
+
expect(doc).to have_received(:database_collection=).with([doc])
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns the docs' do
|
43
|
+
end
|
44
|
+
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.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Lang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.0'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.0'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: couchrest
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 3.
|
81
|
+
version: 3.12.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 3.
|
88
|
+
version: 3.12.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: timecop
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,9 +130,8 @@ files:
|
|
130
130
|
- Rakefile
|
131
131
|
- couch_potato-rspec.gemspec
|
132
132
|
- couch_potato.gemspec
|
133
|
-
- gemfiles/active_support_6_0
|
134
|
-
- gemfiles/active_support_6_1
|
135
133
|
- gemfiles/active_support_7_0
|
134
|
+
- gemfiles/active_support_7_1
|
136
135
|
- init.rb
|
137
136
|
- lib/core_ext/date.rb
|
138
137
|
- lib/core_ext/time.rb
|
@@ -231,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
230
|
- !ruby/object:Gem::Version
|
232
231
|
version: '0'
|
233
232
|
requirements: []
|
234
|
-
rubygems_version: 3.
|
233
|
+
rubygems_version: 3.4.7
|
235
234
|
signing_key:
|
236
235
|
specification_version: 4
|
237
236
|
summary: Ruby persistence layer for CouchDB
|