hanami-rspec 3.0.0.rc1 → 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: 52da36692e852f309936a6de50d48b1e39aae141cd0a90dc8c2a1a2905f7024e
4
- data.tar.gz: 203f42d283c278333080bf223b5f51fb8d7510ba37b3b4421e8ac4f81434faec
3
+ metadata.gz: c4baaba2d178ec3923d5fb41010932f163d2d49d04cefb392dc7f42ca1b8374b
4
+ data.tar.gz: a29d6961031ce60fe544df4b2f60f0e45ee2e9518b3a90650bf89bde2bd3aed2
5
5
  SHA512:
6
- metadata.gz: ace50373169fd424ffc76c832d13d04ad6f43388e1e552e09b776ba59e1b2f221b06fefbff60f455678290640f209dc06166975f16538ffc246a28a43a66e60a
7
- data.tar.gz: 9ee94f6821a888afda9d331f6aa896766314d8192787fc16eb1288987af16815eea758682caafbae53af12c3db3bf969609e02c6243ddf241a58f84b70340408
6
+ metadata.gz: 843469322480c2bf22c7605ece0401e44538858b402dd8c7320ab837b15b892d9956c3b6b112476d9485a397282ab566b10c75aff044ea81528dd0a171d403a1
7
+ data.tar.gz: e686721d90b7d2583323e10273e119962246b91cbdf612420ea741fe75238e565c2126d65bac7a9ae9cada27ec000e8cc1e6a10b78463797ee320a0a5ff60cd2
data/CHANGELOG.md CHANGED
@@ -21,6 +21,23 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve
21
21
 
22
22
  [Unreleased]: https://github.com/hanami/rspec/compare/v3.0.0.rc1...HEAD
23
23
 
24
+ ## [v3.0.0] - 2026-06-30
25
+
26
+ ### Added
27
+
28
+ - Activate Dry Monads' RSpec extension in `spec/support/operations.rb`. (@timriley in #48)
29
+ - Generate a starter spec when running `hanami generate operation`. (@timriley in #48)
30
+ - Generate `spec/support/mailers.rb` to reset recorded mail deliveries between examples tagged `:mailers`. Use this tag for the generated mailer tests. (@timriley in #49)
31
+ - Generate a starter spec when running `hanami generate mailer`. (@timriley in #48)
32
+
33
+ ### Changed
34
+
35
+ - Use `prepend_before` for the generated DatabaseCleaner `:db` hook, so it runs before any other `before` hooks that might touch the database. This prevents factory calls in spec-level `before` blocks from running before the test transaction starts and leaking records across tests. (@timriley in #47)
36
+ - Check for presence of hanami-action gem rather than hanami-controller (now retired). (@cllns in #44)
37
+ - Require Ruby 3.3 or newer.
38
+
39
+ [v3.0.0]: https://github.com/hanami/rspec/compare/v2.3.1...v3.0.0
40
+
24
41
  ## [v3.0.0.rc1] - 2026-06-16
25
42
 
26
43
  ### Added
data/hanami-rspec.gemspec CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.required_ruby_version = ">= 3.3"
32
32
 
33
- spec.add_runtime_dependency "hanami-cli", "~> 3.0.0.rc"
33
+ spec.add_runtime_dependency "hanami-cli", "~> 3.0.0"
34
34
  spec.add_runtime_dependency "rspec", "~> 3.12"
35
35
  spec.add_runtime_dependency "rake", "~> 13.0"
36
36
  spec.add_runtime_dependency "zeitwerk", "~> 2.6"
@@ -16,6 +16,7 @@ module Hanami
16
16
  copy_support_db
17
17
  copy_support_features
18
18
  copy_support_operations
19
+ copy_support_mailers
19
20
  copy_support_requests
20
21
 
21
22
  generate_request_spec
@@ -88,6 +89,15 @@ module Hanami
88
89
  )
89
90
  end
90
91
 
92
+ def copy_support_mailers
93
+ return unless Hanami.bundled?("hanami-mailer")
94
+
95
+ fs.cp(
96
+ fs.expand_path(fs.join("generators", "support_mailers.rb"), __dir__),
97
+ fs.expand_path(fs.join("spec", "support", "mailers.rb"))
98
+ )
99
+ end
100
+
91
101
  def copy_support_requests
92
102
  fs.cp(
93
103
  fs.expand_path(fs.join("generators", "support_requests.rb"), __dir__),
@@ -37,7 +37,7 @@ module Hanami
37
37
  <<~RUBY
38
38
  # frozen_string_literal: true
39
39
 
40
- RSpec.describe #{class_name} do
40
+ RSpec.describe #{class_name}, :mailers do
41
41
  subject(:mailer) { described_class.new }
42
42
 
43
43
  # Inspect the delivered message to set expectations on its contents:
@@ -10,9 +10,7 @@ RSpec.configure do |config|
10
10
  #
11
11
  # Modify this proc (or any code below) if you only need specific databases cleaned.
12
12
  all_databases = -> {
13
- slices = [Hanami.app] + Hanami.app.slices.with_nested
14
-
15
- slices.each_with_object([]) { |slice, dbs|
13
+ Hanami.app.with_slices.each_with_object([]) { |slice, dbs|
16
14
  next unless slice.key?("db.rom")
17
15
 
18
16
  dbs.concat slice["db.rom"].gateways.values.map(&:connection)
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Reset recorded mail deliveries between examples tagged `:mailers`
4
+ #
5
+ # In the test env, mail is delivered via a shared test delivery method, so recorded deliveries
6
+ # accumulate across examples. Tag any example that sends mail with `:mailers` to start with a clean
7
+ # slate:
8
+ #
9
+ # RSpec.describe Mailers::Welcome, :mailers do
10
+ # # ...
11
+ # end
12
+ RSpec.configure do |config|
13
+ config.prepend_before :each, :mailers do
14
+ Hanami.app.with_slices.each do |slice|
15
+ next unless slice.key?("mailers.delivery_method")
16
+
17
+ slice["mailers.delivery_method"].clear
18
+ end
19
+ end
20
+ end
@@ -5,6 +5,6 @@ module Hanami
5
5
  # The current hanami-rspec version.
6
6
  #
7
7
  # @api public
8
- VERSION = "3.0.0.rc1"
8
+ VERSION = "3.0.0"
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanakai team
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 3.0.0.rc
18
+ version: 3.0.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 3.0.0.rc
25
+ version: 3.0.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +104,7 @@ files:
104
104
  - lib/hanami/rspec/generators/support_db.rb
105
105
  - lib/hanami/rspec/generators/support_db_cleaning.rb
106
106
  - lib/hanami/rspec/generators/support_features.rb
107
+ - lib/hanami/rspec/generators/support_mailers.rb
107
108
  - lib/hanami/rspec/generators/support_operations.rb
108
109
  - lib/hanami/rspec/generators/support_requests.rb
109
110
  - lib/hanami/rspec/generators/support_rspec.rb