couch_potato-rspec 4.2.0 → 4.3.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/lib/couch_potato/rspec/stub_db.rb +17 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfb9baa1278ce79d353157cf6494ea874279354b8d24f500b958566bfc4a9f59
|
|
4
|
+
data.tar.gz: '0596cfd3cfceb218b2a2bcf5cabeee7b5b2bb6959f89416bb61bc5e067e6bc0f'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9517337195be2078727cf8f372de1fd5f371793ed137fb08fea26f475b7afcaca7deac3f05f720b3c46b807a40360dc83be49d7f2785e049ad71860839159bb8
|
|
7
|
+
data.tar.gz: 5bdaefe1478a853296612ad4d7d7530cb06ba6831109d623b06ea28136a03a21af23942cd5ce3925951d0f991229db329613ffc360b43b5fb185d13c30b8e53f
|
|
@@ -25,7 +25,13 @@ module CouchPotato::RSpec
|
|
|
25
25
|
stub = allow(@clazz).to receive(@view)
|
|
26
26
|
stub.with(*@args) if @args
|
|
27
27
|
stub.and_return(view_stub)
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
view_return_value = if flex_view? && return_value.is_a?(Array)
|
|
30
|
+
stub_flex_results(return_value)
|
|
31
|
+
else
|
|
32
|
+
return_value
|
|
33
|
+
end
|
|
34
|
+
allow(@db).to receive(:view).with(view_stub).and_return(view_return_value)
|
|
29
35
|
return unless return_value.respond_to?(:first)
|
|
30
36
|
|
|
31
37
|
allow(@db).to receive(:first).with(view_stub).and_return(return_value.first)
|
|
@@ -42,6 +48,16 @@ module CouchPotato::RSpec
|
|
|
42
48
|
allow(@db).to receive(:first!).with(view_stub).and_raise(CouchPotato::NotFound)
|
|
43
49
|
end
|
|
44
50
|
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def flex_view?
|
|
55
|
+
@clazz.execute_view(@view.to_s, {}).is_a?(CouchPotato::View::FlexViewSpec)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def stub_flex_results(docs)
|
|
59
|
+
instance_double(CouchPotato::View::FlexViewSpec::Results, docs:)
|
|
60
|
+
end
|
|
45
61
|
end
|
|
46
62
|
|
|
47
63
|
def stub_view(clazz, view, &block)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: couch_potato-rspec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexander Lang
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rspec
|
|
@@ -68,7 +67,6 @@ files:
|
|
|
68
67
|
homepage: http://github.com/langalex/couch_potato
|
|
69
68
|
licenses: []
|
|
70
69
|
metadata: {}
|
|
71
|
-
post_install_message:
|
|
72
70
|
rdoc_options: []
|
|
73
71
|
require_paths:
|
|
74
72
|
- lib
|
|
@@ -83,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
83
81
|
- !ruby/object:Gem::Version
|
|
84
82
|
version: '0'
|
|
85
83
|
requirements: []
|
|
86
|
-
rubygems_version: 3.
|
|
87
|
-
signing_key:
|
|
84
|
+
rubygems_version: 3.6.9
|
|
88
85
|
specification_version: 4
|
|
89
86
|
summary: RSpec matchers for Couch Potato
|
|
90
87
|
test_files:
|