rails_mocks 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/rails_mocks/middleware.rb +1 -0
- data/lib/rails_mocks/version.rb +1 -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: 1c7eeabff6df4f175b12564da147569d9bd5293d14324adce29f898db195fed7
|
4
|
+
data.tar.gz: 3f9d570f3b92829b0509fbd57b8e7722780c7a3459f5073d2b1345e27d855579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0afbd5e35748729e0d2cc2a4edd0c340f79c9b14cea70652a3c5e5b2ab5c72455764dc637274c56a1c98c77adc44f005e691185cf1faf3a6492966a1afbd76b7
|
7
|
+
data.tar.gz: 36bf7cf54c3a772f0cfba3f80999b3eb063e50e5a21d28fea4e82b7877eddbce378ade0d3a547f22d08e728c017fc9d37ad7f7e414ce65c30582445eef244044
|
data/README.md
CHANGED
@@ -19,6 +19,7 @@ What we can execute before make request on the rails side:
|
|
19
19
|
# Instead of User we can use any rails constant
|
20
20
|
# It can be name of service, model, controller, etc
|
21
21
|
allow(User).to receive(:name)
|
22
|
+
allow_any_instance_of(User).to receive(:email).and_return("user@email.com")
|
22
23
|
allow(Book).to receive(:title).and_return("The Book")
|
23
24
|
allow(OrderService).to receive(:new).with(sum: 543).and_return(double(total: 543, id: 1))
|
24
25
|
allow(SumService).to receive(:new).with(double(a: 1, b: 5, c: 4)).and_return(double(sum: 10))
|
@@ -34,6 +35,12 @@ req.headers["RAILS_MOCKS"] = JSON.stringify([
|
|
34
35
|
allow: "User",
|
35
36
|
receive: "name"
|
36
37
|
},
|
38
|
+
|
39
|
+
{
|
40
|
+
allow_any_instance_of: "User",
|
41
|
+
receive: "name",
|
42
|
+
and_return: { body: "user@email.com" }
|
43
|
+
},
|
37
44
|
|
38
45
|
{
|
39
46
|
allow: "Book",
|
data/lib/rails_mocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Kachan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|