rails_mocks 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b26fb523935f95b9297164d82e097493c90961716074d2edf979acfda0760a28
4
- data.tar.gz: 52db39d94d2af8700593d69e06924002bdcb80783021d6bc1e059b6a7ba08a4b
3
+ metadata.gz: 1c7eeabff6df4f175b12564da147569d9bd5293d14324adce29f898db195fed7
4
+ data.tar.gz: 3f9d570f3b92829b0509fbd57b8e7722780c7a3459f5073d2b1345e27d855579
5
5
  SHA512:
6
- metadata.gz: 8ab9be90af13980ec3c7352670e9ef85e11d917ffab6682c616d522f90c9f04225750033a1a23757962b35fd926c315d69b15e5026671db848cd69fabd79d4b7
7
- data.tar.gz: 3339cd0005d7618ab5052dd9268c1f742c8209f4ab0562d830ccec5ce9d9b395960adbdec8b8cdd2ec511923e8c1243c1396459ab39cd3db2fbcd5c5ff429425
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",
@@ -19,6 +19,7 @@ module RailsMocks
19
19
 
20
20
  RSpec::Mocks.with_temporary_scope do
21
21
  RSpec::Mocks::Syntax.enable_expect(self.class)
22
+ self.instance_variable_set(:@hooks, nil)
22
23
 
23
24
  header_data.run_shared_contexts(self)
24
25
  header_data.run_stubs(self)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMocks
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
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
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-09-20 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails