rspec-rails 4.0.0 → 6.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Changelog.md +247 -53
  4. data/README.md +73 -61
  5. data/lib/generators/rspec/channel/channel_generator.rb +1 -1
  6. data/lib/generators/rspec/controller/controller_generator.rb +5 -5
  7. data/lib/generators/rspec/controller/templates/request_spec.rb +6 -1
  8. data/lib/generators/rspec/feature/feature_generator.rb +1 -1
  9. data/lib/generators/rspec/generator/generator_generator.rb +3 -3
  10. data/lib/generators/rspec/generator/templates/generator_spec.rb +1 -2
  11. data/lib/generators/rspec/helper/helper_generator.rb +1 -1
  12. data/lib/generators/rspec/install/install_generator.rb +19 -2
  13. data/lib/generators/rspec/install/templates/spec/rails_helper.rb +13 -8
  14. data/lib/generators/rspec/integration/integration_generator.rb +10 -3
  15. data/lib/generators/rspec/job/job_generator.rb +2 -1
  16. data/lib/generators/rspec/job/templates/job_spec.rb.erb +1 -1
  17. data/lib/generators/rspec/mailbox/mailbox_generator.rb +1 -1
  18. data/lib/generators/rspec/mailer/mailer_generator.rb +5 -3
  19. data/lib/generators/rspec/mailer/templates/mailer_spec.rb +2 -2
  20. data/lib/generators/rspec/mailer/templates/preview.rb +2 -2
  21. data/lib/generators/rspec/model/model_generator.rb +3 -3
  22. data/lib/generators/rspec/request/request_generator.rb +10 -3
  23. data/lib/generators/rspec/scaffold/scaffold_generator.rb +8 -4
  24. data/lib/generators/rspec/scaffold/templates/api_controller_spec.rb +13 -13
  25. data/lib/generators/rspec/scaffold/templates/api_request_spec.rb +20 -20
  26. data/lib/generators/rspec/scaffold/templates/controller_spec.rb +25 -58
  27. data/lib/generators/rspec/scaffold/templates/edit_spec.rb +8 -8
  28. data/lib/generators/rspec/scaffold/templates/index_spec.rb +2 -1
  29. data/lib/generators/rspec/scaffold/templates/new_spec.rb +1 -5
  30. data/lib/generators/rspec/scaffold/templates/request_spec.rb +38 -18
  31. data/lib/generators/rspec/scaffold/templates/show_spec.rb +1 -1
  32. data/lib/generators/rspec/system/system_generator.rb +14 -16
  33. data/lib/generators/rspec/view/view_generator.rb +2 -2
  34. data/lib/generators/rspec.rb +18 -1
  35. data/lib/rspec/rails/adapters.rb +11 -0
  36. data/lib/rspec/rails/configuration.rb +82 -18
  37. data/lib/rspec/rails/example/controller_example_group.rb +1 -0
  38. data/lib/rspec/rails/example/mailbox_example_group.rb +2 -2
  39. data/lib/rspec/rails/example/mailer_example_group.rb +2 -2
  40. data/lib/rspec/rails/example/rails_example_group.rb +8 -0
  41. data/lib/rspec/rails/example/request_example_group.rb +1 -4
  42. data/lib/rspec/rails/example/routing_example_group.rb +0 -2
  43. data/lib/rspec/rails/example/system_example_group.rb +63 -15
  44. data/lib/rspec/rails/example/view_example_group.rb +6 -5
  45. data/lib/rspec/rails/extensions/active_record/proxy.rb +4 -1
  46. data/lib/rspec/rails/feature_check.rb +6 -2
  47. data/lib/rspec/rails/file_fixture_support.rb +11 -10
  48. data/lib/rspec/rails/fixture_file_upload_support.rb +19 -14
  49. data/lib/rspec/rails/fixture_support.rb +49 -24
  50. data/lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb +6 -3
  51. data/lib/rspec/rails/matchers/action_mailbox.rb +14 -5
  52. data/lib/rspec/rails/matchers/active_job.rb +32 -6
  53. data/lib/rspec/rails/matchers/have_enqueued_mail.rb +34 -5
  54. data/lib/rspec/rails/matchers/have_http_status.rb +5 -5
  55. data/lib/rspec/rails/matchers/relation_match_array.rb +1 -1
  56. data/lib/rspec/rails/matchers/routing_matchers.rb +2 -2
  57. data/lib/rspec/rails/matchers/send_email.rb +122 -0
  58. data/lib/rspec/rails/matchers.rb +1 -0
  59. data/lib/rspec/rails/vendor/capybara.rb +1 -3
  60. data/lib/rspec/rails/version.rb +1 -1
  61. data/lib/rspec/rails/view_assigns.rb +0 -18
  62. data/lib/rspec/rails/view_rendering.rb +13 -11
  63. data/lib/rspec-rails.rb +13 -11
  64. data.tar.gz.sig +0 -0
  65. metadata +28 -27
  66. metadata.gz.sig +0 -0
  67. /data/lib/generators/rspec/{integration → request}/templates/request_spec.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e8f5dabd4f5335dc409c77670d7aef552636874486111f105613d54e4270375
4
- data.tar.gz: 72f211f8667a1d6faedaa8e02877958ccd742c5591107ed568a620fc38999c55
3
+ metadata.gz: 3754c96bcbfa8f8685aed3416c1923bf19b2f78610241c4e01d16a7a5425e0db
4
+ data.tar.gz: 72c02a8443b6410da61768369f1ac53fabcd6cd2fd9efeca36a1c5033ce4f430
5
5
  SHA512:
6
- metadata.gz: a4125a040fcc9d7b1e9d8ee802f2d9ad75bc581a3e9263c329db8ddaccfd49988ccaab066c0aebad50e3b78a99d0ebe22e04a9648e44f6e1284325ea112e4c63
7
- data.tar.gz: e08c9439828c7f1b2f3ec543ea72d554f92d79adde6cb01e19d8486c3fc64887432239d1159d4aea7a6b8811cd4f3aaff811b777b3dff80569facfaa38ede625
6
+ metadata.gz: 879fba62ac81954bd7d2428cf356b32530e50a4eabc57137d903162ebdde1c395036da6568cb91765d6b5eeb8a5544bfe8a70e78f6520de897b5676f23c6a6cd
7
+ data.tar.gz: 7f3ce35fe10aaa8ec773b5515a607867a9a4a7dc8b57a98773411dd9b1434ec4583d723d99afe56b13968f7ddd3a8fa6fd404469e9ee9454eb243b38c1e381b5
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,82 +1,253 @@
1
- ### 4.0.0.rc1 / 2020-03-13
2
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0.beta4...v4.0.0.rc1)
1
+ ### Development
2
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...6-1-maintenance)
3
+
4
+ ### 6.1.2 / 2024-03-19
5
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.1...v6.1.2)
6
+
7
+ Bug Fixes:
8
+
9
+ * Fix generated mailer paths to match Rails convention. (Patrício dos Santos, #2735)
10
+ * Fix class in template for generator specs. (Nicolas Buduroi, #2744)
11
+
12
+ ### 6.1.1 / 2024-01-25
13
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.1.0...v6.1.1)
14
+
15
+ Bug Fixes:
16
+
17
+ * Improved deprecation message for `RSpec::Rails::Configuration.fixture_paths`
18
+ (Benoit Tigeot, #2720)
19
+ * Fix support for namespaced fixtures in Rails 7.1. (Benedikt Deicke, #2716)
20
+
21
+ ### 6.1.0 / 2023-11-21
22
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.4...v6.1.0)
3
23
 
4
24
  Enhancements:
5
25
 
6
- * Allow `ActiveJob` matchers `#on_queue` modifier to take symbolic queue names. (Nils Sommer, #2283)
7
- * The scaffold generator now generates request specs in preference to controller specs.
8
- (Luka Lüdicke, #2288)
9
- * Add configuration option to disable ActiveRecord. (Jon Rowe, Phil Pirozhkov, Hermann Mayer, #2266)
10
- * Set `ActionDispatch::SystemTesting::Server.silence_puma = true` when running system specs.
11
- (ta1kt0me, Benoit Tigeot, #2289)
26
+ * Support for Rails 7.1
27
+ * Minor tweak to generated `rails_helper.rb` to use `Rails.root.join`.
28
+ (@masato-bkn, Ryo Nakamura, #2640, #2678)
29
+ * Add `RSpec::Rails::Configuration.fixture_paths` configuration to support
30
+ the matching change to `ActiveRecord::TestFixtures`, previous singular
31
+ form is deprecated and will be removed in Rails 7.2. (Juan Gueçaimburu, #2673)
32
+ * Add `send_email` matcher to match emails rather than specific jobs.
33
+ (Andrei Kaleshka, #2670)
34
+ * When using `render` in view specs, `:locals` will now be merged into the
35
+ default implicit template, allowing `render locals: {...}` style calls.
36
+ (Jon Rowe, #2686)
37
+ * Add support for `Rails.config.action_mailer.preview_paths` on Rails 7.1/
38
+ (Jon Rowe, #2706)
39
+
40
+ ### 6.0.4 / 2023-11-21
41
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.3...v6.0.4)
12
42
 
13
43
  Bug Fixes:
14
44
 
15
- * Restore previous conditional check for setting `default_url_options` in feature
16
- specs, prevents a `NoMethodError` in some scenarios. (Eugene Kenny, #2277)
17
- * Allow changing `ActiveJob::Base.queue_adapter` inside a system spec.
18
- (Jonathan Rochkind, #2242)
19
- * `rails generate generator` command now creates related spec file (Joel Azemar, #2217)
20
- * Relax upper `capybara` version constraint to allow for Capybara 3.x (Phil Pirozhkov, #2281)
21
- * Clear ActionMailer test mailbox after each example (Benoit Tigeot, #2293)
45
+ * Fuzzy match `have_broadcasted_to` so that argument matchers can be used.
46
+ (Timothy Peraza, #2684)
47
+ * Fix fixture warning during `:context` hooks on Rails `main`. (Jon Rowe, #2685)
48
+ * Fix `stub_template` on Rails `main`. (Jon Rowe, #2685)
49
+ * Fix variable name in scaffolded view specs when namespaced. (Taketo Takashima, #2694)
50
+ * Prevent `take_failed_screenshot` producing an additional error through `metadata`
51
+ access. (Jon Rowe, #2704)
52
+ * Use `ActiveSupport::ExecutionContext::TestHelper` on Rails 7+. (Jon Rowe, #2711)
53
+ * Fix leak of templates stubbed with `stub_template` on Rails 7.1. (Jon Rowe, #2714)
22
54
 
23
- ### 4.0.0.beta4
24
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0.beta3...v4.0.0.beta4)
55
+ ### 6.0.3 / 2023-05-31
56
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.2...v6.0.3)
57
+
58
+ Bug Fixes:
59
+
60
+ * Set `ActiveStorage::FixtureSet.file_fixture_path` when including file fixture support.
61
+ (Jason Yates, #2671)
62
+ * Allow `broadcast_to` matcher to take Symbols. (@Vagab, #2680)
63
+
64
+ ### 6.0.2 / 2023-05-04
65
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.1...v6.0.2)
66
+
67
+ Bug Fixes:
68
+
69
+ * Fix ActionView::PathSet when `render_views` is off for Rails 7.1.
70
+ (Eugene Kenny, Iliana, #2631)
71
+ * Support Rails 7.1's `#fixtures_paths` in example groups (removes a deprecation warning).
72
+ (Nicholas Simmons, #2664)
73
+ * Fix `have_enqueued_job` to properly detect enqueued jobs when other jobs were
74
+ performed inside the expectation block. (Slava Kardakov, Phil Pirozhkov, #2573)
75
+
76
+ ### 6.0.1 / 2022-10-18
77
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.0...v6.0.1)
78
+
79
+ Bug Fixes:
80
+
81
+ * Prevent tagged logged support in Rails 7 calling `#name`. (Jon Rowe, #2625)
82
+
83
+ ### 6.0.0 / 2022-10-10
84
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.2...v6.0.0)
25
85
 
26
86
  Enhancements:
27
87
 
28
- * Add argument matcher support to `have_enqueued_*` matchers. (Phil Pirozhkov, #2206)
29
- * Switch generated templates to use ruby 1.9 hash keys. (Tanbir Hasan, #2224)
30
- * Add `have_been_performed`/`have_performed_job`/`perform_job` ActiveJob
31
- matchers (Isaac Seymour, #1785)
32
- * Default to generating request specs rather than controller specs when
33
- generating a controller (Luka Lüdicke, #2222)
88
+ * Support Rails 7
89
+ * Template tweaks to remove instance variables from generated specs. (Takuma Ishikawa, #2599)
90
+ * Generators now respects default path configuration option. (@vivekmiyani, #2508)
91
+
92
+ Breaking Changes:
93
+
94
+ * Drop support for Rails below 6.1
95
+ * Drop support for Ruby below 2.5 (following supported versions of Rails 6.1)
96
+ * Change the order of `after_teardown` from `after` to `around` in system
97
+ specs to improve compatibility with extensions and Capybara. (Tim Diggins, #2596)
98
+
99
+ Deprecations:
100
+
101
+ * Deprecates integration spec generator (`rspec:integration`)
102
+ which was an alias of request spec generator (`rspec:request`)
103
+ (Luka Lüdicke, #2374)
104
+
105
+ ### 5.1.2 / 2022-04-24
106
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.1...v5.1.2)
34
107
 
35
108
  Bug Fixes:
36
109
 
37
- * Prevent `driven_by(:selenium)` being called due to hook precedence.
38
- (Takumi Shotoku, #2188)
39
- * Prevent a `WrongScopeError` being thrown during loading fixtures on Rails
40
- 6.1 development version. (Edouard Chin, #2215)
41
- * Fix Mocha mocking support with `should`. (Phil Pirozhkov, #2256)
110
+ * Fix controller scaffold templates parameter name. (Taketo Takashima, #2591)
111
+ * Include generator specs in the inferred list of specs. (Jason Karns, #2597)
112
+
113
+ ### 5.1.1 / 2022-03-07
114
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.0...v5.1.1)
42
115
 
43
- ### 4.0.0.beta3
44
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0.beta2...v4.0.0.beta3)
116
+ Bug Fixes:
117
+
118
+ * Properly handle global id serialised arguments in `have_enqueued_mail`.
119
+ (Jon Rowe, #2578)
120
+
121
+ ### 5.1.0 / 2022-01-26
122
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.3...v5.1.0)
45
123
 
46
124
  Enhancements:
47
125
 
48
- * Adds support for JRuby on Rails 5.2 and 6
49
- * Add support for parameterised mailers (Ignatius Reza, #2125)
50
- * Add ActionMailbox spec helpers and test type (James Dabbs, #2119)
51
- * Add ActionCable spec helpers and test type (Vladimir Dementyev, #2113)
52
- * Add support for partial args when using `have_enqueued_mail`
53
- (Ignatius Reza, #2118, #2125)
54
- * Add support for time arguments for `have_enqueued_job` (@alpaca-tc, #2157)
55
- * Improve path parsing in view specs render options. (John Hawthorn, #2115)
56
- * Add routing spec template as an option for generating controller specs.
57
- (David Revelo, #2134)
126
+ * Make the API request scaffold template more consistent and compatible with
127
+ Rails 6.1. (Naoto Hamada, #2484)
128
+ * Change the scaffold `rails_helper.rb` template to use `require_relative`.
129
+ (Jon Dufresne, #2528)
130
+
131
+ ### 5.0.3 / 2022-01-26
132
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.2...v5.0.3)
58
133
 
59
134
  Bug Fixes:
60
135
 
61
- * Replace `before_teardown` as well as `after_teardown` to ensure screenshots
62
- are generated correctly. (Jon Rowe, #2164)
63
- * `ActionView::FixtureResolver#hash` has been renamed to `ActionView::FixtureResolver#data`.
64
- (Penelope Phippen, #2076)
65
- * Add missing require for `have_enqueued_mail` matcher. (Ignatius Reza, #2117)
136
+ * Properly name params in controller and request spec templates when
137
+ using the `--model-name` parameter. (@kenzo-tanaka, #2534)
138
+ * Fix parameter matching with mail delivery job and
139
+ ActionMailer::MailDeliveryJob. (Fabio Napoleoni, #2516, #2546)
140
+ * Fix Rails 7 `have_enqueued_mail` compatibility (Mikael Henriksson, #2537, #2546)
141
+
142
+ ### 5.0.2 / 2021-08-14
143
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...v5.0.2)
144
+
145
+ Bug Fixes:
146
+
147
+ * Prevent generated job specs from duplicating `_job` in filenames.
148
+ (Nick Flückiger, #2496)
149
+ * Fix `ActiveRecord::TestFixture#uses_transaction` by using example description
150
+ to replace example name rather than example in our monkey patched
151
+ `run_in_transaction?` method. (Stan Lo, #2495)
152
+ * Prevent keyword arguments being lost when methods are invoked dynamically
153
+ in controller specs. (Josh Cheek, #2509, #2514)
154
+
155
+ ### 5.0.1 / 2021-03-18
156
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.0...v5.0.1)
157
+
158
+ Bug Fixes:
159
+
160
+ * Limit multibyte example descriptions when used in system tests for #method_name
161
+ which ends up as screenshot names etc. (@y-yagi, #2405, #2487)
162
+
163
+ ### 5.0.0 / 2021-03-09
164
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...v5.0.0)
165
+
166
+ Enhancements:
167
+
168
+ * Support new #file_fixture_path and new fixture test support code. (Jon Rowe, #2398)
169
+ * Support for Rails 6.1. (Benoit Tigeot, Jon Rowe, Phil Pirozhkov, and more #2398)
170
+
171
+ Breaking Changes:
172
+
173
+ * Drop support for Rails below 5.2.
174
+
175
+ ### 4.1.1 / 2021-03-09
66
176
 
67
- ### 4.0.0.beta2
68
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0.beta1...v4.0.0.beta2)
177
+ Bug Fixes:
178
+
179
+ * Remove generated specs when destroying a generated controller.
180
+ (@Naokimi, #2475)
181
+
182
+ ### 4.1.0 / 2021-03-06
183
+
184
+ Enhancements:
185
+
186
+ * Issue a warning when using job matchers with `#at` mismatch on `usec` precision.
187
+ (Jon Rowe, #2350)
188
+ * Generated request specs now have a bare `_spec` suffix instead of `request_spec`.
189
+ (Eloy Espinaco, Luka Lüdicke, #2355, #2356, #2378)
190
+ * Generated scaffold now includes engine route helpers when inside a mountable engine.
191
+ (Andrew W. Lee, #2372)
192
+ * Improve request spec "controller" scaffold when no action is specified.
193
+ (Thomas Hareau, #2399)
194
+ * Introduce testing snippets concept (Phil Pirozhkov, Benoit Tigeot, #2423)
195
+ * Prevent collisions with `let(:name)` for Rails 6.1 and `let(:method_name)` on older
196
+ Rails. (Benoit Tigeot, #2461)
197
+
198
+ ### 4.0.2 / 2020-12-26
199
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.1...v4.0.2)
69
200
 
70
201
  Bug Fixes:
71
202
 
72
- * Fix version dependencies in gemspec.
203
+ * Indent all extra failure lines output from system specs. (Alex Robbin, #2321)
204
+ * Generated request spec for update now uses the correct let. (Paul Hanyzewski, #2344)
205
+ * Return `true`/`false` from predicate methods in config rather than raw values.
206
+ (Phil Pirozhkov, Jon Rowe, #2353, #2354)
207
+ * Remove old #fixture_path feature detection code which broke under newer Rails.
208
+ (Koen Punt, Jon Rowe, #2370)
209
+ * Fix an error when `use_active_record` is `false` (Phil Pirozhkov, #2423)
210
+
211
+ ### 4.0.1 / 2020-05-16
212
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0...v4.0.1)
213
+
214
+ Bug Fixes:
73
215
 
74
- ### 4.0.0.beta1
75
- [Full Changelog](https://github.com/rspec/rspec-rails/compare/v3.9.0...v4.0.0.beta1)
216
+ * Remove warning when calling `driven_by` in system specs. (Aubin Lorieux, #2302)
217
+ * Fix comparison of times for `#at` in job matchers. (Jon Rowe, Markus Doits, #2304)
218
+ * Allow `have_enqueued_mail` to match when a sub class of `ActionMailer::DeliveryJob`
219
+ is set using `<Class>.delivery_job=`. (Atsushi Yoshida #2305)
220
+ * Restore Ruby 2.2.x compatibility. (Jon Rowe, #2332)
221
+ * Add `required_ruby_version` to gem spec. (Marc-André Lafortune, #2319, #2338)
222
+
223
+ ### 4.0.0 / 2020-03-24
224
+ [Full Changelog](https://github.com/rspec/rspec-rails/compare/v3.9.1...v4.0.0)
76
225
 
77
226
  Enhancements:
78
227
 
79
228
  * Adds support for Rails 6. (Penelope Phippen, Benoit Tigeot, Jon Rowe, #2071)
229
+ * Adds support for JRuby on Rails 5.2 and 6
230
+ * Add support for parameterised mailers (Ignatius Reza, #2125)
231
+ * Add ActionMailbox spec helpers and test type (James Dabbs, #2119)
232
+ * Add ActionCable spec helpers and test type (Vladimir Dementyev, #2113)
233
+ * Add support for partial args when using `have_enqueued_mail`
234
+ (Ignatius Reza, #2118, #2125)
235
+ * Add support for time arguments for `have_enqueued_job` (@alpaca-tc, #2157)
236
+ * Improve path parsing in view specs render options. (John Hawthorn, #2115)
237
+ * Add routing spec template as an option for generating controller specs.
238
+ (David Revelo, #2134)
239
+ * Add argument matcher support to `have_enqueued_*` matchers. (Phil Pirozhkov, #2206)
240
+ * Switch generated templates to use ruby 1.9 hash keys. (Tanbir Hasan, #2224)
241
+ * Add `have_been_performed`/`have_performed_job`/`perform_job` ActiveJob
242
+ matchers (Isaac Seymour, #1785)
243
+ * Default to generating request specs rather than controller specs when
244
+ generating a controller (Luka Lüdicke, #2222)
245
+ * Allow `ActiveJob` matchers `#on_queue` modifier to take symbolic queue names. (Nils Sommer, #2283)
246
+ * The scaffold generator now generates request specs in preference to controller specs.
247
+ (Luka Lüdicke, #2288)
248
+ * Add configuration option to disable ActiveRecord. (Jon Rowe, Phil Pirozhkov, Hermann Mayer, #2266)
249
+ * Set `ActionDispatch::SystemTesting::Server.silence_puma = true` when running system specs.
250
+ (ta1kt0me, Benoit Tigeot, #2289)
80
251
 
81
252
  Bug Fixes:
82
253
 
@@ -86,12 +257,35 @@ Bug Fixes:
86
257
  deprecated. (Pavel Rosický, #2092)
87
258
  * `ActionView::Template#formats` has been deprecated and replaced by
88
259
  `ActionView::Template#format`(Seb Jacobs, #2100)
260
+ * Replace `before_teardown` as well as `after_teardown` to ensure screenshots
261
+ are generated correctly. (Jon Rowe, #2164)
262
+ * `ActionView::FixtureResolver#hash` has been renamed to `ActionView::FixtureResolver#data`.
263
+ (Penelope Phippen, #2076)
264
+ * Prevent `driven_by(:selenium)` being called due to hook precedence.
265
+ (Takumi Shotoku, #2188)
266
+ * Prevent a `WrongScopeError` being thrown during loading fixtures on Rails
267
+ 6.1 development version. (Edouard Chin, #2215)
268
+ * Fix Mocha mocking support with `should`. (Phil Pirozhkov, #2256)
269
+ * Restore previous conditional check for setting `default_url_options` in feature
270
+ specs, prevents a `NoMethodError` in some scenarios. (Eugene Kenny, #2277)
271
+ * Allow changing `ActiveJob::Base.queue_adapter` inside a system spec.
272
+ (Jonathan Rochkind, #2242)
273
+ * `rails generate generator` command now creates related spec file (Joel Azemar, #2217)
274
+ * Relax upper `capybara` version constraint to allow for Capybara 3.x (Phil Pirozhkov, #2281)
275
+ * Clear ActionMailer test mailbox after each example (Benoit Tigeot, #2293)
89
276
 
90
277
  Breaking Changes:
91
278
 
92
279
  * Drops support for Rails below 5.0
93
280
  * Drops support for Ruby below 2.3
94
281
 
282
+ ### 3.9.1 / 2020-03-10
283
+ [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.9.0...v3.9.1)
284
+
285
+ Bug Fixes:
286
+
287
+ * Add missing require for have_enqueued_mail matcher. (Ignatius Reza, #2117)
288
+
95
289
  ### 3.9.0 / 2019-10-08
96
290
  [Full Changelog](https://github.com/rspec/rspec-rails/compare/v3.8.3...v3.9.0)
97
291
 
@@ -116,7 +310,7 @@ Bug Fixes:
116
310
 
117
311
  Bug Fixes:
118
312
 
119
- * Namespaced fixtures now generate a `/` seperated path rather than an `_`.
313
+ * Namespaced fixtures now generate a `/` separated path rather than an `_`.
120
314
  (@nxlith, #2077)
121
315
  * Check the arity of `errors` before attempting to use it to generate the `be_valid`
122
316
  error message. (Kevin Kuchta, #2096)
@@ -276,7 +470,7 @@ Enhancements:
276
470
 
277
471
  Bug fixes:
278
472
 
279
- * Prevent asset helpers from taking precendence over route helpers. (Prem Sichanugrist, #1496)
473
+ * Prevent asset helpers from taking precedence over route helpers. (Prem Sichanugrist, #1496)
280
474
  * Prevent `NoMethodError` during failed `have_rendered` assertions on weird templates.
281
475
  (Jon Rowe, #1623).
282
476
 
@@ -398,7 +592,7 @@ Enhancements:
398
592
  * Add support for PATCH to route specs created via scaffold. (Igor Zubkov, #1336)
399
593
  * Improve controller and routing spec calls to `routes` by using `yield`
400
594
  instead of `call`. (Anton Davydov, #1308)
401
- * Add support for `ActiveJob` specs as standard `RSpec::Rails::RailsExampleGoup`s
595
+ * Add support for `ActiveJob` specs as standard `RSpec::Rails::RailsExampleGroup`s
402
596
  via both `type: :job` and inferring type from spec directory `spec/jobs`.
403
597
  (Gabe Martin-Dempesy, #1361)
404
598
  * Include `RSpec::Rails::FixtureSupport` into example groups using metadata
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rspec-rails [![Build Status][]][travis-ci] [![Code Climate][]][code-climate] [![Gem Version][]](gem-version)
1
+ # rspec-rails [![Code Climate][]][code-climate] [![Gem Version][]][gem-version]
2
2
 
3
3
  `rspec-rails` brings the [RSpec][] testing framework to [Ruby on Rails][]
4
4
  as a drop-in alternative to its default testing framework, Minitest.
@@ -8,10 +8,13 @@ They’re also specifications (or _specs,_ for short):
8
8
  detailed explanations of how the application is supposed to behave,
9
9
  expressed in plain English.
10
10
 
11
- Use **[`rspec-rails` 1.x][]** for Rails 2.x.
11
+ According to [RSpec Rails new versioning strategy][] use:
12
+ * **[`rspec-rails` 6.x][]** for Rails 6.1 or 7.x.
13
+ * **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
14
+ * **[`rspec-rails` 4.x][]** for Rails from 5.x or 6.x.
15
+ * **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
16
+ * **[`rspec-rails` 1.x][]** for Rails 2.x.
12
17
 
13
- [Build Status]: https://secure.travis-ci.org/rspec/rspec-rails.svg?branch=master
14
- [travis-ci]: https://travis-ci.org/rspec/rspec-rails
15
18
  [Code Climate]: https://codeclimate.com/github/rspec/rspec-rails.svg
16
19
  [code-climate]: https://codeclimate.com/github/rspec/rspec-rails
17
20
  [Gem Version]: https://badge.fury.io/rb/rspec-rails.svg
@@ -19,23 +22,32 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
19
22
  [RSpec]: https://rspec.info/
20
23
  [Ruby on Rails]: https://rubyonrails.org/
21
24
  [`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails
25
+ [`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance
26
+ [`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance
27
+ [`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-1-maintenance
28
+ [`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-1-maintenance
29
+ [RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md
22
30
 
23
31
  ## Installation
24
32
 
33
+ **IMPORTANT** This README / branch refers to the 6.1.x stable release series, only bugfixes from this series will
34
+ be added here. See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) if you want or
35
+ require the latest unstable features.
36
+
25
37
  1. Add `rspec-rails` to **both** the `:development` and `:test` groups
26
38
  of your app’s `Gemfile`:
27
39
 
28
40
  ```ruby
29
- # Run against the latest stable release
41
+ # Run against this stable release
30
42
  group :development, :test do
31
- gem 'rspec-rails', '~> 4.0'
43
+ gem 'rspec-rails', '~> 6.1.0'
32
44
  end
33
45
 
34
- # Or, run against the master branch
35
- # (requires master-branch versions of all related RSpec libraries)
46
+ # Or, run against the main branch
47
+ # (requires main-branch versions of all related RSpec libraries)
36
48
  group :development, :test do
37
49
  %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
38
- gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'master'
50
+ gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
39
51
  end
40
52
  end
41
53
  ```
@@ -75,8 +87,8 @@ read the [`rspec-rails` upgrade notes][] to find out what to watch out for.
75
87
 
76
88
  Be sure to check the general [RSpec upgrade notes][] as well.
77
89
 
78
- [`rspec-rails` upgrade notes]: https://www.relishapp.com/rspec/rspec-rails/docs/upgrade
79
- [RSpec upgrade notes]: https://relishapp.com/rspec/docs/upgrade
90
+ [`rspec-rails` upgrade notes]: https://rspec.info/features/6-0/rspec-rails/upgrade
91
+ [RSpec upgrade notes]: https://rspec.info/upgrading-from-rspec-2/
80
92
 
81
93
  ## Usage
82
94
 
@@ -170,7 +182,7 @@ rspec ./spec/models/post_spec.rb:3 # Post before publication cannot have comment
170
182
  For an in-depth look at the RSpec DSL, including lots of examples,
171
183
  read the official Cucumber documentation for [RSpec Core][].
172
184
 
173
- [RSpec Core]: https://relishapp.com/rspec/rspec-core/docs
185
+ [RSpec Core]: https://rspec.info/features/3-12/rspec-core
174
186
 
175
187
  ### Helpful Rails Matchers
176
188
 
@@ -182,37 +194,37 @@ In addition to [the matchers that come standard in RSpec][],
182
194
  here are some extras that make it easier
183
195
  to test the various parts of a Rails system:
184
196
 
185
- | RSpec matcher | Delegates to | Available in | Notes |
186
- | ------------------------ | ----------------- | ------------------------------- | -------------------------------------------------------- |
187
- | [`be_a_new`][] | | all | primarily intended for controller specs |
188
- | [`render_template`][] | `assert_template` | request / controller / view | use with `expect(response).to` |
189
- | [`redirect_to`][] | `assert_redirect` | request / controller | use with `expect(response).to` |
190
- | [`route_to`] | `assert_routing` | routing / controller | replaces `route_for` from version 1.x |
191
- | [`be_routable`] | | routing / controller | usu. for `expect(...).not_to be_routable` |
192
- | [`have_http_status`][] | | request / controller / feature | |
193
- | [`match_array`][] | | all | for comparing arrays of ActiveRecord objects |
194
- | [`have_been_enqueued`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
195
- | [`have_enqueued_job`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
197
+ | RSpec matcher | Delegates to | Available in | Notes |
198
+ | ------------------------ | ------------------- | ------------------------------- | -------------------------------------------------------- |
199
+ | [`be_a_new`][] | | all | primarily intended for controller specs |
200
+ | [`render_template`][] | `assert_template` | request / controller / view | use with `expect(response).to` |
201
+ | [`redirect_to`][] | `assert_redirect` | request / controller | use with `expect(response).to` |
202
+ | [`route_to`] | `assert_recognizes` | routing / controller | use with `expect(...).to route_to` |
203
+ | [`be_routable`] | | routing / controller | use with `expect(...).not_to be_routable` |
204
+ | [`have_http_status`][] | | request / controller / feature | |
205
+ | [`match_array`][] | | all | for comparing arrays of ActiveRecord objects |
206
+ | [`have_been_enqueued`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
207
+ | [`have_enqueued_job`][] | | all | requires config: `ActiveJob::Base.queue_adapter = :test` |
196
208
 
197
209
  Follow the links above for examples of how each matcher is used.
198
210
 
199
- [the matchers that come standard in RSpec]: https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
200
- [`be_a_new`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/be-a-new-matcher
201
- [`render_template`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/render-template-matcher
202
- [`redirect_to`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/redirect-to-matcher
203
- [`route_to`]: https://relishapp.com/rspec/rspec-rails/docs/routing-specs/route-to-matcher
204
- [`be_routable`]: https://relishapp.com/rspec/rspec-rails/docs/routing-specs/be-routable-matcher
205
- [`have_http_status`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/have-http-status-matcher
206
- [`match_array`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/activerecord-relation-match-array
207
- [`have_been_enqueued`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/have-been-enqueued-matcher
208
- [`have_enqueued_job`]: https://relishapp.com/rspec/rspec-rails/docs/matchers/have-enqueued-job-matcher
211
+ [the matchers that come standard in RSpec]: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers
212
+ [`be_a_new`]: https://rspec.info/features/6-0/rspec-rails/matchers/new-record-matcher
213
+ [`render_template`]: https://rspec.info/features/6-0/rspec-rails/matchers/render-template-matcher
214
+ [`redirect_to`]: https://rspec.info/features/6-0/rspec-rails/matchers/redirect-to-matcher
215
+ [`route_to`]: https://rspec.info/features/6-0/rspec-rails/routing-specs/route-to-matcher
216
+ [`be_routable`]: https://rspec.info/features/6-0/rspec-rails/routing-specs/be-routable-matcher
217
+ [`have_http_status`]: https://rspec.info/features/6-0/rspec-rails/matchers/have-http-status-matcher
218
+ [`match_array`]: https://rspec.info/features/6-0/rspec-rails/matchers/relation-match-array
219
+ [`have_been_enqueued`]: https://rspec.info/features/6-0/rspec-rails/matchers/have-been-enqueued-matcher
220
+ [`have_enqueued_job`]: https://rspec.info/features/6-0/rspec-rails/matchers/have-enqueued-job-matcher
209
221
 
210
222
  ### What else does RSpec Rails add?
211
223
 
212
224
  For a comprehensive look at RSpec Rails’ features,
213
225
  read the [official Cucumber documentation][].
214
226
 
215
- [official Cucumber documentation]: https://relishapp.com/rspec/rspec-rails/docs
227
+ [official Cucumber documentation]: https://rspec.info/features/6-0/rspec-rails
216
228
 
217
229
  ## What tests should I write?
218
230
 
@@ -222,18 +234,18 @@ Each one inherits from one of Rails’ built-in `TestCase` classes,
222
234
  meaning the helper methods provided by default in Rails tests
223
235
  are available in RSpec, as well.
224
236
 
225
- | Spec type | Corresponding Rails test class |
226
- | -------------- | -------------------------------- |
227
- | [model][] | |
228
- | [controller][] | [`ActionController::TestCase`][] |
229
- | [mailer][] | `ActionMailer::TestCase` |
230
- | [job][] | |
231
- | [view][] | `ActionView::TestCase` |
232
- | [routing][] | |
233
- | [helper][] | `ActionView::TestCase` |
234
- | [request][] | [`ActionDispatch::IntegrationTest`][] |
235
- | [feature][] | |
236
- | [system][] | [`ActionDispatch::SystemTestCase`][] |
237
+ | Spec type | Corresponding Rails test class |
238
+ | -------------- | -------------------------------- |
239
+ | [model][] | |
240
+ | [controller][] | [`ActionController::TestCase`][] |
241
+ | [mailer][] | `ActionMailer::TestCase` |
242
+ | [job][] | |
243
+ | [view][] | `ActionView::TestCase` |
244
+ | [routing][] | |
245
+ | [helper][] | `ActionView::TestCase` |
246
+ | [request][] | [`ActionDispatch::IntegrationTest`][] |
247
+ | [feature][] | |
248
+ | [system][] | [`ActionDispatch::SystemTestCase`][] |
237
249
 
238
250
  Follow the links above to see examples of each spec type,
239
251
  or for official Rails API documentation on the given `TestCase` class.
@@ -257,20 +269,20 @@ RSpec.describe User, type: :model do
257
269
  ...
258
270
  ```
259
271
 
260
- [request]: https://relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec
261
- [feature]: https://www.relishapp.com/rspec/rspec-rails/docs/feature-specs/feature-spec
262
- [system]: https://relishapp.com/rspec/rspec-rails/docs/system-specs/system-spec
263
- [model]: https://www.relishapp.com/rspec/rspec-rails/docs/model-specs
264
- [controller]: https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs
265
- [mailer]: https://relishapp.com/rspec/rspec-rails/docs/mailer-specs
266
- [job]: https://relishapp.com/rspec/rspec-rails/docs/job-specs/job-spec
267
- [view]: https://www.relishapp.com/rspec/rspec-rails/docs/view-specs/view-spec
268
- [routing]: https://www.relishapp.com/rspec/rspec-rails/docs/routing-specs
269
- [helper]: https://www.relishapp.com/rspec/rspec-rails/docs/helper-specs/helper-spec
272
+ [request]: https://rspec.info/features/6-0/rspec-rails/request-specs/request-spec
273
+ [feature]: https://rspec.info/features/6-0/rspec-rails/feature-specs/feature-spec
274
+ [system]: https://rspec.info/features/6-0/rspec-rails/system-specs/system-specs
275
+ [model]: https://rspec.info/features/6-0/rspec-rails/model-specs
276
+ [controller]: https://rspec.info/features/6-0/rspec-rails/controller-specs
277
+ [mailer]: https://rspec.info/features/6-0/rspec-rails/mailer-specs
278
+ [job]: https://rspec.info/features/6-0/rspec-rails/job-specs/job-spec
279
+ [view]: https://rspec.info/features/6-0/rspec-rails/view-specs/view-spec
280
+ [routing]: https://rspec.info/features/6-0/rspec-rails/routing-specs
281
+ [helper]: https://rspec.info/features/6-0/rspec-rails/helper-specs/helper-spec
270
282
  [`ActionDispatch::IntegrationTest`]: https://api.rubyonrails.org/classes/ActionDispatch/IntegrationTest.html
271
283
  [`ActionDispatch::SystemTestCase`]: https://api.rubyonrails.org/classes/ActionDispatch/SystemTestCase.html
272
284
  [`ActionController::TestCase`]: https://api.rubyonrails.org/classes/ActionController/TestCase.html
273
- [in the appropriate folder]: https://relishapp.com/rspec/rspec-rails/docs/directory-structure
285
+ [in the appropriate folder]: https://rspec.info/features/6-0/rspec-rails/directory-structure
274
286
 
275
287
  ### System specs, feature specs, request specs–what’s the difference?
276
288
 
@@ -353,10 +365,10 @@ you can run the specs and Cucumber features, or submit a pull request.
353
365
 
354
366
  ### RSpec base libraries
355
367
 
356
- * <https://github.com/rspec/rspec>
357
- * <https://github.com/rspec/rspec-core>
358
- * <https://github.com/rspec/rspec-expectations>
359
- * <https://github.com/rspec/rspec-mocks>
368
+ * https://github.com/rspec/rspec
369
+ * https://github.com/rspec/rspec-core
370
+ * https://github.com/rspec/rspec-expectations
371
+ * https://github.com/rspec/rspec-mocks
360
372
 
361
373
  ### Recommended third-party extensions
362
374
 
@@ -5,7 +5,7 @@ module Rspec
5
5
  # @private
6
6
  class ChannelGenerator < Base
7
7
  def create_channel_spec
8
- template 'channel_spec.rb.erb', File.join('spec/channels', class_path, "#{file_name}_channel_spec.rb")
8
+ template 'channel_spec.rb.erb', target_path('channels', class_path, "#{file_name}_channel_spec.rb")
9
9
  end
10
10
  end
11
11
  end