rspec-goodies 0.1.3 → 0.2.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: 329814af431141f0f8bbcf536e7fb7a44c93443d72a04a5de828846221142ad3
4
- data.tar.gz: 9593b164a64de413f98ef93b974c030b0516fd5f304d04338cef0bd4e6c3b75c
3
+ metadata.gz: 30838394508830956834ded5eb3a87465d8f0ab8022a78a752beb3fc10939551
4
+ data.tar.gz: 87deb6c4267502eb77e5490a3237a98ff6591870ed898974ee456b254d9ad197
5
5
  SHA512:
6
- metadata.gz: 4f8aa401ba3286dd94104b5eb5338b165b4a7a834a47e9f31b3a5a04fcb8bbce568fe30fa7bd6492fc411ce856d4458fd138a33bcb5fb33aec427f9dd273deb6
7
- data.tar.gz: 3bf310ebe13ad2c26dddad8ee924ea680874dcc2645a141f2d15c162ed1d734c90a27ebf99194737587267580c2206b79e285426b99da114cc0bf4738b19e6c0
6
+ metadata.gz: c2a2f307e76b9fbd88e568ed86af9aa99692b458be9dd94c8080a3764966e0663e7f26ad414f0b061e9ac62b62bec6668facb785375cc7de6e90210b8c075663
7
+ data.tar.gz: 148cad6c7f51cd2f40e449e2a1c710b27d7ba9cdbc7140dfa7394c3dfa9b947bac32fd2d749202c713d9bf3fc38a36b9444b18cf5030b7841cb704a63abb8fb2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec-goodies (0.1.3)
4
+ rspec-goodies (0.2.0)
5
5
  activesupport
6
6
  byebug
7
7
  rails
@@ -207,6 +207,7 @@ GEM
207
207
 
208
208
  PLATFORMS
209
209
  arm64-darwin-21
210
+ arm64-darwin-23
210
211
 
211
212
  DEPENDENCIES
212
213
  rspec
@@ -9,12 +9,6 @@ module RSpec
9
9
  service_stub
10
10
  end
11
11
 
12
- def stub_rails_logger_as_spy
13
- instance_spy("ActiveSupport::Logger").tap do |stub|
14
- allow(::Rails).to receive(:logger).and_return(stub)
15
- end
16
- end
17
-
18
12
  def stub_class_const(klass, const_string, value)
19
13
  raise ArgumentError, "a Class or Module must be passed in" if !klass.is_a?(Class) && !klass.is_a?(Module)
20
14
 
@@ -38,7 +32,7 @@ module RSpec
38
32
 
39
33
  # Stub environment variable so that it doesn't leak out of tests
40
34
  def stub_env(name, value)
41
- allow(ENV).to receive(:[]).with(name).and_return(value)
35
+ allow(ENV).to(receive(:[]).with(name).and_return(value))
42
36
  end
43
37
 
44
38
  # Only works with nested credentials for now
@@ -68,7 +62,25 @@ module RSpec
68
62
  end
69
63
  end
70
64
 
71
- allow(::Rails.application).to receive(:credentials).and_return(OpenStruct.new(stubbed_credentials_config))
65
+ allow(::Rails.application).to(receive(:credentials).and_return(OpenStruct.new(stubbed_credentials_config)))
66
+ end
67
+
68
+ # Ensure scoped otherwise we get "has leaked into another example" errors
69
+ def with_rails_logger_stubbed_as_spy
70
+ raise ArgumentError, "block required" unless block_given?
71
+
72
+ original_logger = ::Rails.logger
73
+ logger_spy = instance_spy("ActiveSupport::Logger")
74
+
75
+ begin
76
+ allow(::Rails).to(receive(:logger).and_return(logger_spy))
77
+
78
+ yield(logger_spy)
79
+ ensure
80
+ allow(::Rails).to(receive(:logger).and_return(original_logger))
81
+ end
82
+
83
+ logger_spy
72
84
  end
73
85
  end
74
86
  end
@@ -66,7 +66,7 @@ class SidekiqJobsEnqueuedMatcher
66
66
  end
67
67
 
68
68
  matched_count += 1
69
- rescue RSpec::Expectations::ExpectationNotMetError
69
+ rescue RSpec::Expectations::ExpectationNotMetError => e
70
70
  # Doesn't contribute to matched_count if any expectations fail
71
71
  end
72
72
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rspec-goodies"
5
- spec.version = "0.1.3"
5
+ spec.version = "0.2.0"
6
6
  spec.authors = ["James Hu"]
7
7
 
8
8
  spec.summary = "RSpec goodies full of helpers, matchers, and more"
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
19
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
20
- `git ls-files -z`.split("\x0").reject do |f|
20
+ %x(git ls-files -z).split("\x0").reject do |f|
21
21
  (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
22
22
  end
23
23
  end
@@ -26,13 +26,13 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  # Uncomment to register a new dependency of your gem
29
- spec.add_dependency "activesupport"
30
- spec.add_dependency "byebug"
31
- spec.add_dependency "rails"
29
+ spec.add_dependency("activesupport")
30
+ spec.add_dependency("byebug")
31
+ spec.add_dependency("rails")
32
32
 
33
- spec.add_development_dependency "rspec"
34
- spec.add_development_dependency "sidekiq"
35
- spec.add_development_dependency "timecop"
33
+ spec.add_development_dependency("rspec")
34
+ spec.add_development_dependency("sidekiq")
35
+ spec.add_development_dependency("timecop")
36
36
 
37
37
  # For more information and examples about making a new gem, check out our
38
38
  # guide at: https://bundler.io/guides/creating_gem.html
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-goodies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-17 00:00:00.000000000 Z
11
+ date: 2025-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.1.6
139
+ rubygems_version: 3.3.27
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: RSpec goodies full of helpers, matchers, and more