grift 2.1.0 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be076a2312ee3278d68f393d8ace60b12aa44cec9923336fbe0469366be5c9cd
4
- data.tar.gz: b38846285534aaf9e56c413c77b84da307655a1ac336aba9c8a4fa3b676a34c7
3
+ metadata.gz: bf2421884afdf8fff5e1b01f197d7249352312fcd7463818f54dee8bd665b251
4
+ data.tar.gz: 2491a5140014420c3ee5324c30caa32f8911b5b618417fa525dd9e34b82e6c4f
5
5
  SHA512:
6
- metadata.gz: 25cdd247a6c4eacff1c77b099d22475bedb56d7a885beb1365e71e6798bddee87401fe1257e65cfbb5af5137b8458af650f2916f32b000a0712c3494e3f45459
7
- data.tar.gz: 2c0e207ea0c7eb8db2719af429aaf0831fcb18169f5167d92f0111207e5a228e9f2a5d49131565dd499043268b65c4481fbd4497dca918c993326d7ed683102f
6
+ metadata.gz: 554d8d9425f55e7c8dd803db4311e76153614e13415aaaba44ccab586b4699a2192891f3c731b404f8cb5d4acaef796460ff15f6dca4fa50911e22590b236a97
7
+ data.tar.gz: f6fa5b36f3c80ec589a1e6d51c833611cd6ea1170765750a8623e84916d8c2ae9d795ed06474f0c4411d8828bb715845e78cf688d45b60581e480a630229d6c9
@@ -0,0 +1,3 @@
1
+ # github sponsors
2
+ github:
3
+ - clarkedb
@@ -6,7 +6,7 @@ updates:
6
6
  package-ecosystem: bundler
7
7
  target-branch: main
8
8
  schedule:
9
- interval: weekly
9
+ interval: monthly
10
10
  labels:
11
11
  - dependencies
12
12
  assignees:
@@ -15,12 +15,12 @@ jobs:
15
15
  BUNDLE_WITHOUT: development:test
16
16
 
17
17
  steps:
18
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
19
19
 
20
- - name: Set up Ruby 3.1
20
+ - name: Set up Ruby 3.3
21
21
  uses: ruby/setup-ruby@v1
22
22
  with:
23
- ruby-version: 3.1
23
+ ruby-version: 3.3
24
24
  bundler-cache: true
25
25
 
26
26
  - name: Rubocop
@@ -33,21 +33,21 @@ jobs:
33
33
  strategy:
34
34
  fail-fast: false
35
35
  matrix:
36
- ruby: ["2.7", "3.0", "3.1", "3.2"]
36
+ ruby: ["2.7", "3.0", "3.1", "3.2", "3.3", "3.4"]
37
37
 
38
38
  steps:
39
- - uses: actions/checkout@v3
39
+ - uses: actions/checkout@v4
40
40
  - uses: ruby/setup-ruby@v1
41
41
  with:
42
42
  ruby-version: ${{ matrix.ruby }}
43
43
  bundler-cache: true
44
44
 
45
45
  - name: Test
46
- continue-on-error: ${{ matrix.experimental }}
47
- run: bundle exec rake test
46
+ run: bundle exec rake --trace test
48
47
 
49
48
  - name: Upload coverage to Codecov
50
- uses: codecov/codecov-action@v3
49
+ if: always()
50
+ uses: codecov/codecov-action@v4
51
51
  with:
52
52
  token: ${{ secrets.CODECOV_TOKEN }}
53
53
  files: ./coverage/.resultset.json
data/.gitignore CHANGED
@@ -29,7 +29,7 @@
29
29
 
30
30
  # for a library or gem, you might want to ignore these files since the code is
31
31
  # intended to run in multiple environments; otherwise, check them in:
32
- # Gemfile.lock
32
+ Gemfile.lock
33
33
  .ruby-version
34
34
  .ruby-gemset
35
35
 
data/CHANGELOG.md CHANGED
@@ -8,21 +8,40 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
8
8
 
9
9
  None
10
10
 
11
+ ## [3.0.0](https://github.com/clarkedb/grift/releases/tag/v3.0.0) - 2024-12-26
12
+
13
+ ### Breaking
14
+
15
+ - All mocks are now scoped to the current thread for thread-safety ([#256](https://github.com/clarkedb/grift/pull/256))
16
+ - For parallelized test suites using processes this is not a breaking change
17
+ - This fixes intermittent test failures sometimes seen when codebases have threads calling mocked methods
18
+
19
+ ### Added
20
+
21
+ - Official support for Ruby 3.4 ([#257](https://github.com/clarkedb/grift/pull/257))
22
+ - Direct access to mock results/calls without calling `mock` ([#258](https://github.com/clarkedb/grift/pull/258))
23
+
24
+ ## [2.2.0](https://github.com/clarkedb/grift/releases/tag/v2.2.0) - 2024-01-13
25
+
26
+ ### Added
27
+
28
+ - Official support for Ruby 3.3 ([#203](https://github.com/clarkedb/grift/pull/203))
29
+
11
30
  ## [2.1.0](https://github.com/clarkedb/grift/releases/tag/v2.1.0) - 2022-12-27
12
31
 
13
32
  ### Added
14
33
 
15
- * Official support for Ruby 3.2 ([#126](https://github.com/clarkedb/grift/pull/126))
16
- * Support for finite/self-terminating mocking for more precision in testing where a method may get called multiple times
17
- + The Grift API now supports `mock_return_value_once`, `mock_return_value_n_times`, and `mock_return_values_in_order` ([#135](https://github.com/clarkedb/grift/pull/135))
18
- + The Grift API now supports `mock_implementation_once` and `mock_implementation_n_times` ([#136](https://github.com/clarkedb/grift/pull/136))
34
+ - Official support for Ruby 3.2 ([#126](https://github.com/clarkedb/grift/pull/126))
35
+ - Support for finite/self-terminating mocking for more precision in testing where a method may get called multiple times
36
+ - The Grift API now supports `mock_return_value_once`, `mock_return_value_n_times`, and `mock_return_values_in_order` ([#135](https://github.com/clarkedb/grift/pull/135))
37
+ - The Grift API now supports `mock_implementation_once` and `mock_implementation_n_times` ([#136](https://github.com/clarkedb/grift/pull/136))
19
38
 
20
39
  ## [2.0.1](https://github.com/clarkedb/grift/releases/tag/v2.0.1) - 2022-03-27
21
40
 
22
41
  ### Fixed
23
42
 
24
- * When spying on a method that takes a block, the block now gets forwarded to the original method ([#78](https://github.com/clarkedb/grift/pull/78))
25
- * When mocking the implementation, if a block is not provided a `Grift::Error` is raised instead of a `LocalJumpError` ([#77](https://github.com/clarkedb/grift/pull/77))
43
+ - When spying on a method that takes a block, the block now gets forwarded to the original method ([#78](https://github.com/clarkedb/grift/pull/78))
44
+ - When mocking the implementation, if a block is not provided a `Grift::Error` is raised instead of a `LocalJumpError` ([#77](https://github.com/clarkedb/grift/pull/77))
26
45
 
27
46
  ## [2.0.0](https://github.com/clarkedb/grift/releases/tag/v2.0.0) - 2022-03-14
28
47
 
@@ -30,23 +49,23 @@ This version adds true keyword argument support for Ruby 3. See below for how to
30
49
 
31
50
  ### Changed
32
51
 
33
- * Dropped support for Ruby 2.5 ([#69](https://github.com/clarkedb/grift/pull/69))
34
- * Dropped support for Ruby 2.6 ([#72](https://github.com/clarkedb/grift/pull/72))
35
- * To support keyword arguments, records of call arguments are no longer stored in simple arrays but in a custom Enumerable ([#72](https://github.com/clarkedb/grift/pull/72))
36
- + This changes the way that your tests will interact with mock calls
37
- + When before `calls` returned an array, it returns a `Grift::MockMethod::MockExecutions::MockArguments` object
38
- + Migrating to maintain previous behavior just requires appending `.args` to `calls[i]`
52
+ - Dropped support for Ruby 2.5 ([#69](https://github.com/clarkedb/grift/pull/69))
53
+ - Dropped support for Ruby 2.6 ([#72](https://github.com/clarkedb/grift/pull/72))
54
+ - To support keyword arguments, records of call arguments are no longer stored in simple arrays but in a custom Enumerable ([#72](https://github.com/clarkedb/grift/pull/72))
55
+ - This changes the way that your tests will interact with mock calls
56
+ - When before `calls` returned an array, it returns a `Grift::MockMethod::MockExecutions::MockArguments` object
57
+ - Migrating to maintain previous behavior just requires appending `.args` to `calls[i]`
39
58
 
40
59
  ### Added
41
60
 
42
- * Support for mocking private instance and class methods ([#68](https://github.com/clarkedb/grift/pull/68))
43
- * Support for mocking methods that take positional and keyword arguments ([#72](https://github.com/clarkedb/grift/pull/72))
61
+ - Support for mocking private instance and class methods ([#68](https://github.com/clarkedb/grift/pull/68))
62
+ - Support for mocking methods that take positional and keyword arguments ([#72](https://github.com/clarkedb/grift/pull/72))
44
63
 
45
64
  ### Fixed
46
65
 
47
- * When mocking protected methods, the method now remains protected while mocked and after unmocking ([#68](https://github.com/clarkedb/grift/pull/68))
48
- * When mocking inherited methods, the method goes back to the ancestor's definition after unmocking ([#69](https://github.com/clarkedb/grift/pull/69))
49
- * When mocking methods with keyword arugments in Ruby 3.x, no error is thrown ([#72](https://github.com/clarkedb/grift/pull/72))
66
+ - When mocking protected methods, the method now remains protected while mocked and after unmocking ([#68](https://github.com/clarkedb/grift/pull/68))
67
+ - When mocking inherited methods, the method goes back to the ancestor's definition after unmocking ([#69](https://github.com/clarkedb/grift/pull/69))
68
+ - When mocking methods with keyword arugments in Ruby 3.x, no error is thrown ([#72](https://github.com/clarkedb/grift/pull/72))
50
69
 
51
70
  ## [1.1.0](https://github.com/clarkedb/grift/releases/tag/v1.1.0) - 2022-02-03
52
71
 
@@ -54,7 +73,7 @@ This version adds support for Ruby 3.1 and updates various dependencies.
54
73
 
55
74
  ### Added
56
75
 
57
- * Support Ruby 3.1 ([#52](https://github.com/clarkedb/grift/pull/52))
76
+ - Support Ruby 3.1 ([#52](https://github.com/clarkedb/grift/pull/52))
58
77
 
59
78
  ## [1.0.2](https://github.com/clarkedb/grift/releases/tag/v1.0.2) - 2021-11-11
60
79
 
@@ -62,7 +81,7 @@ This version fixes a bug that prevented the mocking of methods defined by a clas
62
81
 
63
82
  ### Fixed
64
83
 
65
- * Allow mocks of inherited methods ([#34](https://github.com/clarkedb/grift/pull/34))
84
+ - Allow mocks of inherited methods ([#34](https://github.com/clarkedb/grift/pull/34))
66
85
 
67
86
  ## [1.0.1](https://github.com/clarkedb/grift/releases/tag/v1.0.1) - 2021-11-10
68
87
 
@@ -70,7 +89,7 @@ This version fixes a bug that prevented most mocking features in Grift from func
70
89
 
71
90
  ### Fixed
72
91
 
73
- * Uses relative path for yaml config files ([#28](https://github.com/clarkedb/grift/pull/28))
92
+ - Uses relative path for yaml config files ([#28](https://github.com/clarkedb/grift/pull/28))
74
93
 
75
94
  ## [1.0.0](https://github.com/clarkedb/grift/releases/tag/v1.0.0) - 2021-11-06
76
95
 
@@ -78,12 +97,12 @@ The first major version of Grift! 100% documentation and 100% code coverage.
78
97
 
79
98
  ### Added
80
99
 
81
- * Spying on method ([#9](https://github.com/clarkedb/grift/pull/9))
82
- * Mocking method return values ([#9](https://github.com/clarkedb/grift/pull/9))
83
- * Mocking method implementation ([#13](https://github.com/clarkedb/grift/pull/13))
84
- * Restricted methods that cannot be mocked ([#20](https://github.com/clarkedb/grift/pull/20))
85
- * MiniTest Plugin to use hooks and clean up after tests ([#17](https://github.com/clarkedb/grift/pull/17))
86
- * Documentation! ([#23](https://github.com/clarkedb/grift/pull/23))
100
+ - Spying on method ([#9](https://github.com/clarkedb/grift/pull/9))
101
+ - Mocking method return values ([#9](https://github.com/clarkedb/grift/pull/9))
102
+ - Mocking method implementation ([#13](https://github.com/clarkedb/grift/pull/13))
103
+ - Restricted methods that cannot be mocked ([#20](https://github.com/clarkedb/grift/pull/20))
104
+ - MiniTest Plugin to use hooks and clean up after tests ([#17](https://github.com/clarkedb/grift/pull/17))
105
+ - Documentation! ([#23](https://github.com/clarkedb/grift/pull/23))
87
106
 
88
107
  ## [0.1.0](https://github.com/clarkedb/grift/releases/tag/v0.1.0) - 2021-10-12
89
108
 
data/Gemfile CHANGED
@@ -8,16 +8,16 @@ gemspec
8
8
  gem 'rake', '>= 12.0'
9
9
 
10
10
  group :development, :test do
11
- gem 'codecov'
12
- gem 'minitest', '>= 5.0'
13
- gem 'minitest-reporters', '>= 1.4.3'
14
- gem 'simplecov', '>= 0.21.2'
11
+ gem 'minitest', '~> 5.25'
12
+ gem 'minitest-reporters', '~> 1.7'
13
+ gem 'simplecov', '~> 0.22'
14
+ gem 'simplecov-cobertura', '~> 2.1'
15
15
  end
16
16
 
17
17
  group :development, :lint do
18
- gem 'overcommit'
19
- gem 'rubocop'
20
- gem 'rubocop-minitest'
21
- gem 'rubocop-packaging', '>= 0.5'
22
- gem 'rubocop-performance', '>= 1.0'
18
+ gem 'overcommit', '>= 0.64'
19
+ gem 'rubocop', '~> 1.69.2'
20
+ gem 'rubocop-minitest', '~> 0.36.0'
21
+ gem 'rubocop-packaging', '~> 0.5.2'
22
+ gem 'rubocop-performance', '~> 1.23.0'
23
23
  end
data/README.md CHANGED
@@ -100,29 +100,29 @@ end
100
100
 
101
101
  ### Results
102
102
 
103
- To get the results and details of the calls, call `mock` on your mock method object.
103
+ To get the results and details of the calls, call `calls` or `results` on your mock method object.
104
104
 
105
105
  ```ruby
106
106
  # get the number of times the mocked method has been called
107
- my_mock.mock.count
107
+ my_mock.count
108
108
  #=> 2
109
109
 
110
110
  # get args for each call to the method while mocked
111
- my_mock.mock.calls[0].args
111
+ my_mock.calls[0].args
112
112
  #=> ['first_arg1', 'second_arg1']
113
113
 
114
114
  # get kwargs for each call to the method while mocked
115
- my_mock.mock.calls[0].kwargs
115
+ my_mock.calls[0].kwargs
116
116
  #=> { first_arg1: 'value' }
117
117
 
118
118
  # get results (return value) for each call to the method while mocked
119
- my_mock.mock.results
119
+ my_mock.results
120
120
  #=> ['result1', 'result2']
121
121
  ```
122
122
 
123
123
  ## Requirements
124
124
 
125
- Grift supports all Ruby versions >= 2.7 (including 3.2).
125
+ Grift supports all Ruby versions >= 2.7 (including 3.4).
126
126
 
127
127
  ## Development
128
128
 
@@ -29,3 +29,6 @@ String:
29
29
  Symbol:
30
30
  - "=="
31
31
  - to_s
32
+
33
+ Thread:
34
+ - "current"
@@ -7,7 +7,7 @@ module Grift
7
7
  # needing to cleanup the mocks after each test.
8
8
  #
9
9
  # To setup the plugin for your tests, you should include the
10
- # following code in your `test_helper`
10
+ # following code in your +test_helper+
11
11
  #
12
12
  # class Minitest::Test
13
13
  # include Grift::MinitestPlugin
@@ -11,6 +11,22 @@ module Grift
11
11
  CACHE_METHOD_PREFIX = 'grift_cache'
12
12
  private_constant :CACHE_METHOD_PREFIX
13
13
 
14
+ ##
15
+ # Hashes the class and method for tracking mocks.
16
+ #
17
+ # @example
18
+ # Grift::MockMethod.hash_key(String, :upcase)
19
+ # #=> 'String#upcase'
20
+ #
21
+ # @param klass [Class]
22
+ # @param method_name [Symbol]
23
+ #
24
+ # @return [String] the hash of the class and method
25
+ #
26
+ def self.hash_key(klass, method_name)
27
+ "#{klass}##{method_name}"
28
+ end
29
+
14
30
  ##
15
31
  # A new instance of MockMethod. Should be initialized via {Grift.mock} or {Grift.spy_on}
16
32
  #
@@ -36,7 +52,7 @@ module Grift
36
52
  @method_name = method_name
37
53
  @true_method_cached = false
38
54
  @mock_executions = MockExecutions.new
39
- @cache_method_name = "#{CACHE_METHOD_PREFIX}_#{method_name}".to_sym
55
+ @cache_method_name = :"#{CACHE_METHOD_PREFIX}_#{method_name}"
40
56
 
41
57
  # class methods are really instance methods of the singleton class
42
58
  @class_method = klass.singleton_class.method_defined?(method_name, true) ||
@@ -85,7 +101,7 @@ module Grift
85
101
 
86
102
  ##
87
103
  # Clears the mock execution and calls data for this mock, and
88
- # mocks the method to return `nil`.
104
+ # mocks the method to return +nil+.
89
105
  #
90
106
  # @return [Grift::MockMethod::MockExecutions]
91
107
  #
@@ -440,19 +456,81 @@ module Grift
440
456
  end
441
457
 
442
458
  ##
443
- # Hashes the class and method for tracking mocks.
459
+ # Returns an array of the args used in each call to the mocked method
460
+ # This is syntactical sugar equivalent to calling +mock+ and then +calls+.
461
+ #
462
+ # @see Grift::MockMethod::MockExecutions#calls
444
463
  #
445
464
  # @example
446
- # Grift::MockMethod.hash_key(String, :upcase)
447
- # #=> 'String#upcase'
465
+ # my_mock = Grift.spy_on(Number, :+)
466
+ # x = (3 + 4) + 5
467
+ # my_mock.calls.map(&:values)
468
+ # #=> [[4], [5]]
448
469
  #
449
- # @param klass [Class]
450
- # @param method_name [Symbol]
470
+ # @return [Array<Grift::MockMethod::MockExecutions::MockArguments>] an array of MockArguments
451
471
  #
452
- # @return [String] the hash of the class and method
472
+ def calls
473
+ @mock_executions.calls
474
+ end
475
+
476
+ ##
477
+ # Returns true if there have been no calls to the mock.
478
+ # This is syntactical sugar equivalent to calling +mock+ and then +empty?+.
453
479
  #
454
- def self.hash_key(klass, method_name)
455
- "#{klass}##{method_name}"
480
+ # @see Grift::MockMethod::MockExecutions#empty?
481
+ #
482
+ # @example
483
+ # my_mock = Grift.mock(String, :upcase)
484
+ # my_mock.mock.empty?
485
+ # #=> true
486
+ # "apple".upcase
487
+ # #=> "APPLE"
488
+ # my_mock.empty?
489
+ # #=> false
490
+ #
491
+ # @return [Boolean] if the executions are empty
492
+ #
493
+ def empty?
494
+ @mock_executions.empty?
495
+ end
496
+
497
+ ##
498
+ # Returns the count of mock executions.
499
+ # This is syntactical sugar equivalent to calling +mock+ and then +count+.
500
+ #
501
+ # @see Grift::MockMethod::MockExecutions#count
502
+ #
503
+ # @example
504
+ # my_mock = Grift.mock(String, :upcase)
505
+ # my_mock.mock.count
506
+ # #=> 0
507
+ # "apple".upcase
508
+ # #=> "APPLE"
509
+ # my_mock.count
510
+ # #=> 1
511
+ #
512
+ # @return [Number] the number of executions
513
+ #
514
+ def count
515
+ @mock_executions.count
516
+ end
517
+
518
+ ##
519
+ # Returns an array of the results of each call to the mocked method
520
+ # This is syntactical sugar equivalent to calling +mock+ and then +results+.
521
+ #
522
+ # @see Grift::MockMethod::MockExecutions#results
523
+ #
524
+ # @example
525
+ # my_mock = Grift.spy_on(Number, :+)
526
+ # x = (3 + 4) + 5
527
+ # my_mock.results
528
+ # #=> [7, 12]
529
+ #
530
+ # @return [Array] an array of results
531
+ #
532
+ def results
533
+ @mock_executions.results
456
534
  end
457
535
 
458
536
  private
@@ -547,7 +625,7 @@ module Grift
547
625
  ##
548
626
  # Checks for the original access of the method (public, protected, private),
549
627
  # and if that definition is inherited from an ancestor (super) class.
550
- # Returns `nil` if no definition for the method is found.
628
+ # Returns +nil+ if no definition for the method is found.
551
629
  #
552
630
  # @return [Symbol] the method access
553
631
  # @return [Boolean] true if the method is inherited
data/lib/grift/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Grift
4
4
  # gem version
5
- VERSION = '2.1.0'
5
+ VERSION = '3.0.0'
6
6
  public_constant :VERSION
7
7
  end
data/lib/grift.rb CHANGED
@@ -14,18 +14,18 @@ require 'grift/version'
14
14
  # through this base module.
15
15
  #
16
16
  module Grift
17
- @mock_store = Grift::MockStore.new
18
-
19
17
  class << self
20
18
  # @example
21
19
  # Grift.mock_store
22
- # @return [Grift::MockStore] the current store of mocked methods
23
- attr_reader :mock_store
20
+ # @return [Grift::MockStore] the current store of mocked methods scoped to the thread
21
+ def mock_store
22
+ Thread.current[:grift_internal_mock_store] ||= Grift::MockStore.new
23
+ end
24
24
 
25
25
  ##
26
26
  # Mocks the given method to return the provided value.
27
27
  # This is syntactical sugar equivalent to calling
28
- # `spy_on` and then `mock_return_value`.
28
+ # +spy_on+ and then +mock_return_value+.
29
29
  #
30
30
  # @example
31
31
  # my_mock = Grift.mock(MyClass, :some_method, true)
@@ -79,7 +79,7 @@ module Grift
79
79
  #
80
80
  def mock_method?(klass, method)
81
81
  hash_key = Grift::MockMethod.hash_key(klass, method)
82
- @mock_store.include?(hash_key)
82
+ mock_store.include?(hash_key)
83
83
  end
84
84
 
85
85
  ##
@@ -121,7 +121,7 @@ module Grift
121
121
  # @return [Array<Grift::MockMethod::MockExecutions>]
122
122
  #
123
123
  def clear_mocks(klass)
124
- @mock_store.mocks(klass: klass).each(&:mock_clear)
124
+ mock_store.mocks(klass: klass).each(&:mock_clear)
125
125
  end
126
126
 
127
127
  ##
@@ -134,7 +134,7 @@ module Grift
134
134
  # @return [Array<Grift::MockMethod::MockExecutions>]
135
135
  #
136
136
  def clear_all_mocks
137
- @mock_store.mocks.each(&:mock_clear)
137
+ mock_store.mocks.each(&:mock_clear)
138
138
  end
139
139
 
140
140
  ##
@@ -149,7 +149,7 @@ module Grift
149
149
  # @return [Array<Grift::MockMethod::MockExecutions>]
150
150
  #
151
151
  def reset_mocks(klass)
152
- @mock_store.mocks(klass: klass).each(&:mock_reset)
152
+ mock_store.mocks(klass: klass).each(&:mock_reset)
153
153
  end
154
154
 
155
155
  ##
@@ -162,7 +162,7 @@ module Grift
162
162
  # @return [Array<Grift::MockMethod::MockExecutions>]
163
163
  #
164
164
  def reset_all_mocks
165
- @mock_store.mocks.each(&:mock_reset)
165
+ mock_store.mocks.each(&:mock_reset)
166
166
  end
167
167
 
168
168
  ##
@@ -183,9 +183,9 @@ module Grift
183
183
  #
184
184
  def restore_mocks(klass, watch: false)
185
185
  if watch
186
- @mock_store.mocks(klass: klass).each { |m| m.mock_restore(watch: true) }
186
+ mock_store.mocks(klass: klass).each { |m| m.mock_restore(watch: true) }
187
187
  else
188
- @mock_store.remove(klass: klass)
188
+ mock_store.remove(klass: klass)
189
189
  end
190
190
  end
191
191
 
@@ -206,9 +206,9 @@ module Grift
206
206
  #
207
207
  def restore_all_mocks(watch: false)
208
208
  if watch
209
- @mock_store.mocks.each { |m| m.mock_restore(watch: true) }
209
+ mock_store.mocks.each { |m| m.mock_restore(watch: true) }
210
210
  else
211
- @mock_store.remove
211
+ mock_store.remove
212
212
  end
213
213
  end
214
214
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grift
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clark Brown
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-27 00:00:00.000000000 Z
11
+ date: 2024-12-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem for simple mocking and spying in Ruby's MiniTest framework.
14
14
  email:
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".github/CODEOWNERS"
21
21
  - ".github/CONTRIBUTING.md"
22
+ - ".github/FUNDING.yml"
22
23
  - ".github/dependabot.yml"
23
24
  - ".github/workflows/ci.yml"
24
25
  - ".gitignore"
@@ -27,7 +28,6 @@ files:
27
28
  - ".yardopts"
28
29
  - CHANGELOG.md
29
30
  - Gemfile
30
- - Gemfile.lock
31
31
  - LICENSE
32
32
  - README.md
33
33
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,81 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- grift (2.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ansi (1.5.0)
10
- ast (2.4.2)
11
- builder (3.2.4)
12
- childprocess (4.1.0)
13
- codecov (0.2.12)
14
- json
15
- simplecov
16
- docile (1.4.0)
17
- iniparse (1.5.0)
18
- json (2.6.3)
19
- minitest (5.16.3)
20
- minitest-reporters (1.5.0)
21
- ansi
22
- builder
23
- minitest (>= 5.0)
24
- ruby-progressbar
25
- overcommit (0.59.1)
26
- childprocess (>= 0.6.3, < 5)
27
- iniparse (~> 1.4)
28
- rexml (~> 3.2)
29
- parallel (1.22.1)
30
- parser (3.1.3.0)
31
- ast (~> 2.4.1)
32
- rainbow (3.1.1)
33
- rake (13.0.6)
34
- regexp_parser (2.6.1)
35
- rexml (3.2.5)
36
- rubocop (1.41.1)
37
- json (~> 2.3)
38
- parallel (~> 1.10)
39
- parser (>= 3.1.2.1)
40
- rainbow (>= 2.2.2, < 4.0)
41
- regexp_parser (>= 1.8, < 3.0)
42
- rexml (>= 3.2.5, < 4.0)
43
- rubocop-ast (>= 1.23.0, < 2.0)
44
- ruby-progressbar (~> 1.7)
45
- unicode-display_width (>= 1.4.0, < 3.0)
46
- rubocop-ast (1.24.0)
47
- parser (>= 3.1.1.0)
48
- rubocop-minitest (0.25.1)
49
- rubocop (>= 0.90, < 2.0)
50
- rubocop-packaging (0.5.2)
51
- rubocop (>= 1.33, < 2.0)
52
- rubocop-performance (1.15.2)
53
- rubocop (>= 1.7.0, < 2.0)
54
- rubocop-ast (>= 0.4.0)
55
- ruby-progressbar (1.11.0)
56
- simplecov (0.22.0)
57
- docile (~> 1.1)
58
- simplecov-html (~> 0.11)
59
- simplecov_json_formatter (~> 0.1)
60
- simplecov-html (0.12.3)
61
- simplecov_json_formatter (0.1.4)
62
- unicode-display_width (2.3.0)
63
-
64
- PLATFORMS
65
- ruby
66
-
67
- DEPENDENCIES
68
- codecov
69
- grift!
70
- minitest (>= 5.0)
71
- minitest-reporters (>= 1.4.3)
72
- overcommit
73
- rake (>= 12.0)
74
- rubocop
75
- rubocop-minitest
76
- rubocop-packaging (>= 0.5)
77
- rubocop-performance (>= 1.0)
78
- simplecov (>= 0.21.2)
79
-
80
- BUNDLED WITH
81
- 2.2.32