rspec-rails 5.1.2 → 6.0.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/Changelog.md +39 -6
- data/README.md +6 -4
- data/lib/generators/rspec/channel/channel_generator.rb +1 -1
- data/lib/generators/rspec/controller/controller_generator.rb +4 -4
- data/lib/generators/rspec/feature/feature_generator.rb +1 -1
- data/lib/generators/rspec/generator/generator_generator.rb +1 -1
- data/lib/generators/rspec/helper/helper_generator.rb +1 -1
- data/lib/generators/rspec/install/install_generator.rb +19 -2
- data/lib/generators/rspec/install/templates/spec/rails_helper.rb +2 -3
- data/lib/generators/rspec/integration/integration_generator.rb +10 -3
- data/lib/generators/rspec/job/job_generator.rb +1 -1
- data/lib/generators/rspec/mailbox/mailbox_generator.rb +1 -1
- data/lib/generators/rspec/mailer/mailer_generator.rb +3 -3
- data/lib/generators/rspec/model/model_generator.rb +3 -3
- data/lib/generators/rspec/request/request_generator.rb +10 -3
- data/lib/generators/rspec/{integration → request}/templates/request_spec.rb +0 -0
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +4 -4
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +15 -0
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +8 -4
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +2 -1
- data/lib/generators/rspec/scaffold/templates/request_spec.rb +15 -0
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +1 -1
- data/lib/generators/rspec/system/system_generator.rb +1 -1
- data/lib/generators/rspec/view/view_generator.rb +2 -2
- data/lib/generators/rspec.rb +18 -1
- data/lib/rspec/rails/adapters.rb +11 -0
- data/lib/rspec/rails/configuration.rb +12 -12
- data/lib/rspec/rails/example/rails_example_group.rb +1 -0
- data/lib/rspec/rails/example/system_example_group.rb +12 -11
- data/lib/rspec/rails/example/view_example_group.rb +4 -4
- data/lib/rspec/rails/feature_check.rb +6 -2
- data/lib/rspec/rails/fixture_file_upload_support.rb +13 -30
- data/lib/rspec/rails/fixture_support.rb +1 -1
- data/lib/rspec/rails/matchers/action_cable/have_broadcasted_to.rb +1 -1
- data/lib/rspec/rails/matchers/active_job.rb +1 -1
- data/lib/rspec/rails/matchers/have_enqueued_mail.rb +3 -2
- data/lib/rspec/rails/matchers/have_http_status.rb +1 -1
- data/lib/rspec/rails/matchers/routing_matchers.rb +2 -2
- data/lib/rspec/rails/vendor/capybara.rb +1 -3
- data/lib/rspec/rails/version.rb +1 -1
- data/lib/rspec/rails/view_assigns.rb +0 -18
- data/lib/rspec/rails/view_rendering.rb +2 -8
- data/lib/rspec-rails.rb +1 -5
- data.tar.gz.sig +0 -0
- metadata +23 -35
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5168244eb73c17800e3ab180f39a65e3400e31fd559cb4f9d44f132f4cecd7f5
|
|
4
|
+
data.tar.gz: e11a77cd0bb1dca2d8f4ad2c1e521e6f7e25fd7d73f564aeaa570bdcd6dbf59c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 218fc008c49a73cde670d9b1141d47e4b5541ec409fee39dfe5ba864613a5c02862139a55647ef92032eebf2e429597e4e202376e4529761494250efe50f98e6
|
|
7
|
+
data.tar.gz: ef02cdf73abce39f27b84b26f43b40c102a9ba52893de8831666c1f1688ee588320998155c88a8284e576a2a53b76eb29e4be8ef62c232382da46e946dec5ca1
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/Changelog.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
### Development
|
|
2
|
-
[Full Changelog](https://github.com/rspec/rspec-rails/compare/
|
|
2
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.0...6-0-maintenance)
|
|
3
|
+
|
|
4
|
+
### 6.0.1 / 2022-10-18
|
|
5
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v6.0.0...6.0.1)
|
|
6
|
+
|
|
7
|
+
Bug Fixes:
|
|
8
|
+
|
|
9
|
+
* Prevent tagged logged support in Rails 7 calling `#name`. (Jon Rowe, #2625)
|
|
10
|
+
|
|
11
|
+
### 6.0.0 / 2022-10-10
|
|
12
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.2...6.0.0)
|
|
13
|
+
|
|
14
|
+
Enhancements:
|
|
15
|
+
|
|
16
|
+
* Support Rails 7
|
|
17
|
+
* Template tweaks to remove instance variables from generated specs. (Takuma Ishikawa, #2599)
|
|
18
|
+
* Generators now respects default path configuration option. (@vivekmiyani, #2508)
|
|
19
|
+
|
|
20
|
+
Breaking Changes:
|
|
21
|
+
|
|
22
|
+
* Drop support for Rails below 6.1
|
|
23
|
+
* Drop support for Ruby below 2.5 (following supported versions of Rails 6.1)
|
|
24
|
+
* Change the order of `after_teardown` from `after` to `around` in system
|
|
25
|
+
specs to improve compatibility with extensions and Capybara. (Tim Diggins, #2596)
|
|
26
|
+
|
|
27
|
+
Deprecations:
|
|
28
|
+
|
|
29
|
+
* Deprecates integration spec generator (`rspec:integration`)
|
|
30
|
+
which was an alias of request spec generator (`rspec:request`)
|
|
31
|
+
(Luka Lüdicke, #2374)
|
|
32
|
+
|
|
33
|
+
### 5.1.2 / 2022-04-24
|
|
34
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.1.1...v5.1.2)
|
|
3
35
|
|
|
4
36
|
Bug Fixes:
|
|
5
37
|
|
|
@@ -31,8 +63,9 @@ Bug Fixes:
|
|
|
31
63
|
|
|
32
64
|
* Properly name params in controller and request spec templates when
|
|
33
65
|
using the `--model-name` parameter. (@kenzo-tanaka, #2534)
|
|
34
|
-
* Fix
|
|
35
|
-
(Fabio Napoleoni,
|
|
66
|
+
* Fix parameter matching with mail delivery job and
|
|
67
|
+
ActionMailer::MailDeliveryJob. (Fabio Napoleoni, #2516, #2546)
|
|
68
|
+
* Fix Rails 7 `have_enqueued_mail` compatibility (Mikael Henriksson, #2537, #2546)
|
|
36
69
|
|
|
37
70
|
### 5.0.2 / 2021-08-14
|
|
38
71
|
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...v5.0.2)
|
|
@@ -78,7 +111,7 @@ Bug Fixes:
|
|
|
78
111
|
|
|
79
112
|
Enhancements:
|
|
80
113
|
|
|
81
|
-
* Issue a warning when using job matchers with `#at`
|
|
114
|
+
* Issue a warning when using job matchers with `#at` mismatch on `usec` precision.
|
|
82
115
|
(Jon Rowe, #2350)
|
|
83
116
|
* Generated request specs now have a bare `_spec` suffix instead of `request_spec`.
|
|
84
117
|
(Eloy Espinaco, Luka Lüdicke, #2355, #2356, #2378)
|
|
@@ -205,7 +238,7 @@ Bug Fixes:
|
|
|
205
238
|
|
|
206
239
|
Bug Fixes:
|
|
207
240
|
|
|
208
|
-
* Namespaced fixtures now generate a `/`
|
|
241
|
+
* Namespaced fixtures now generate a `/` separated path rather than an `_`.
|
|
209
242
|
(@nxlith, #2077)
|
|
210
243
|
* Check the arity of `errors` before attempting to use it to generate the `be_valid`
|
|
211
244
|
error message. (Kevin Kuchta, #2096)
|
|
@@ -365,7 +398,7 @@ Enhancements:
|
|
|
365
398
|
|
|
366
399
|
Bug fixes:
|
|
367
400
|
|
|
368
|
-
* Prevent asset helpers from taking
|
|
401
|
+
* Prevent asset helpers from taking precedence over route helpers. (Prem Sichanugrist, #1496)
|
|
369
402
|
* Prevent `NoMethodError` during failed `have_rendered` assertions on weird templates.
|
|
370
403
|
(Jon Rowe, #1623).
|
|
371
404
|
|
data/README.md
CHANGED
|
@@ -9,7 +9,8 @@ detailed explanations of how the application is supposed to behave,
|
|
|
9
9
|
expressed in plain English.
|
|
10
10
|
|
|
11
11
|
According to [RSpec Rails new versioning strategy][] use:
|
|
12
|
-
* **[`rspec-rails`
|
|
12
|
+
* **[`rspec-rails` 6.x][]** for Rails 6.1 or 7.x.
|
|
13
|
+
* **[`rspec-rails` 5.x][]** for Rails 5.2 or 6.x.
|
|
13
14
|
* **[`rspec-rails` 4.x][]** for Rails from 5.x or 6.x.
|
|
14
15
|
* **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
|
|
15
16
|
* **[`rspec-rails` 1.x][]** for Rails 2.x.
|
|
@@ -25,13 +26,14 @@ According to [RSpec Rails new versioning strategy][] use:
|
|
|
25
26
|
[`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails
|
|
26
27
|
[`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance
|
|
27
28
|
[`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance
|
|
28
|
-
[`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-
|
|
29
|
+
[`rspec-rails` 5.x]: https://github.com/rspec/rspec-rails/tree/5-1-maintenance
|
|
30
|
+
[`rspec-rails` 6.x]: https://github.com/rspec/rspec-rails/tree/6-0-maintenance
|
|
29
31
|
[RSpec Rails new versioning strategy]: https://github.com/rspec/rspec-rails/blob/main/rfcs/versioning-strategy.md
|
|
30
32
|
|
|
31
33
|
## Installation
|
|
32
34
|
|
|
33
35
|
**IMPORTANT** This README / branch refers to the current development build.
|
|
34
|
-
See the [`
|
|
36
|
+
See the [`6-0-maintenance` branch on Github](https://github.com/rspec/rspec-rails/tree/6-0-maintenance) if you want or require the latest stable release.
|
|
35
37
|
|
|
36
38
|
1. Add `rspec-rails` to **both** the `:development` and `:test` groups
|
|
37
39
|
of your app’s `Gemfile`:
|
|
@@ -39,7 +41,7 @@ See the [`5-0-maintenance` branch on Github](https://github.com/rspec/rspec-rail
|
|
|
39
41
|
```ruby
|
|
40
42
|
# Run against this stable release
|
|
41
43
|
group :development, :test do
|
|
42
|
-
gem 'rspec-rails', '~>
|
|
44
|
+
gem 'rspec-rails', '~> 6.0.0'
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
# Or, run against the main branch
|
|
@@ -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',
|
|
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
|
|
@@ -16,14 +16,14 @@ module Rspec
|
|
|
16
16
|
return unless options[:request_specs]
|
|
17
17
|
|
|
18
18
|
template 'request_spec.rb',
|
|
19
|
-
|
|
19
|
+
target_path('requests', class_path, "#{file_name}_spec.rb")
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def generate_controller_spec
|
|
23
23
|
return unless options[:controller_specs]
|
|
24
24
|
|
|
25
25
|
template 'controller_spec.rb',
|
|
26
|
-
|
|
26
|
+
target_path('controllers', class_path, "#{file_name}_controller_spec.rb")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def generate_view_specs
|
|
@@ -35,7 +35,7 @@ module Rspec
|
|
|
35
35
|
actions.each do |action|
|
|
36
36
|
@action = action
|
|
37
37
|
template 'view_spec.rb',
|
|
38
|
-
|
|
38
|
+
target_path('views', file_path, "#{@action}.html.#{options[:template_engine]}_spec.rb")
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ module Rspec
|
|
|
44
44
|
return unless options[:routing_specs]
|
|
45
45
|
|
|
46
46
|
template 'routing_spec.rb',
|
|
47
|
-
|
|
47
|
+
target_path('routing', class_path, "#{file_name}_routing_spec.rb")
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
@@ -10,7 +10,7 @@ module Rspec
|
|
|
10
10
|
def generate_feature_spec
|
|
11
11
|
return unless options[:feature_specs]
|
|
12
12
|
|
|
13
|
-
template template_name,
|
|
13
|
+
template template_name, target_path('features', class_path, filename)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def template_name
|
|
@@ -9,7 +9,7 @@ module Rspec
|
|
|
9
9
|
def generate_generator_spec
|
|
10
10
|
return unless options[:generator_specs]
|
|
11
11
|
|
|
12
|
-
template template_name,
|
|
12
|
+
template template_name, target_path('generator', class_path, filename)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def template_name
|
|
@@ -9,7 +9,7 @@ module Rspec
|
|
|
9
9
|
def generate_helper_spec
|
|
10
10
|
return unless options[:helper_specs]
|
|
11
11
|
|
|
12
|
-
template 'helper_spec.rb',
|
|
12
|
+
template 'helper_spec.rb', target_path('helpers', class_path, "#{file_name}_helper_spec.rb")
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -12,6 +12,8 @@ Description:
|
|
|
12
12
|
Copy rspec files to your application.
|
|
13
13
|
DESC
|
|
14
14
|
|
|
15
|
+
class_option :default_path, type: :string, default: 'spec'
|
|
16
|
+
|
|
15
17
|
def self.source_root
|
|
16
18
|
@source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
|
17
19
|
end
|
|
@@ -20,12 +22,12 @@ DESC
|
|
|
20
22
|
Dir.mktmpdir do |dir|
|
|
21
23
|
generate_rspec_init dir
|
|
22
24
|
template File.join(dir, '.rspec'), '.rspec'
|
|
23
|
-
directory File.join(dir, 'spec'),
|
|
25
|
+
directory File.join(dir, 'spec'), default_path
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def copy_rails_files
|
|
28
|
-
template 'spec/rails_helper.rb'
|
|
30
|
+
template 'spec/rails_helper.rb', "#{default_path}/rails_helper.rb"
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
private
|
|
@@ -41,6 +43,12 @@ DESC
|
|
|
41
43
|
|
|
42
44
|
replace_generator_command(spec_helper_path)
|
|
43
45
|
remove_warnings_configuration(spec_helper_path)
|
|
46
|
+
|
|
47
|
+
unless default_path == "spec"
|
|
48
|
+
dot_rspec_path = File.join(tmpdir, '.rspec')
|
|
49
|
+
|
|
50
|
+
append_default_path(dot_rspec_path)
|
|
51
|
+
end
|
|
44
52
|
end
|
|
45
53
|
|
|
46
54
|
def replace_generator_command(spec_helper_path)
|
|
@@ -58,6 +66,15 @@ DESC
|
|
|
58
66
|
'',
|
|
59
67
|
verbose: false
|
|
60
68
|
end
|
|
69
|
+
|
|
70
|
+
def append_default_path(dot_rspec_path)
|
|
71
|
+
append_to_file dot_rspec_path,
|
|
72
|
+
"--default-path #{default_path}"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def default_path
|
|
76
|
+
options[:default_path]
|
|
77
|
+
end
|
|
61
78
|
end
|
|
62
79
|
end
|
|
63
80
|
end
|
|
@@ -28,8 +28,7 @@ require 'rspec/rails'
|
|
|
28
28
|
begin
|
|
29
29
|
ActiveRecord::Migration.maintain_test_schema!
|
|
30
30
|
rescue ActiveRecord::PendingMigrationError => e
|
|
31
|
-
|
|
32
|
-
exit 1
|
|
31
|
+
abort e.to_s.strip
|
|
33
32
|
end
|
|
34
33
|
<% end -%>
|
|
35
34
|
RSpec.configure do |config|
|
|
@@ -49,7 +48,7 @@ RSpec.configure do |config|
|
|
|
49
48
|
# Remove this line to enable support for ActiveRecord
|
|
50
49
|
config.use_active_record = false
|
|
51
50
|
|
|
52
|
-
# If you enable ActiveRecord support you should
|
|
51
|
+
# If you enable ActiveRecord support you should uncomment these lines,
|
|
53
52
|
# note if you'd prefer not to run each example within a transaction, you
|
|
54
53
|
# should set use_transactional_fixtures to false.
|
|
55
54
|
#
|
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
require 'generators/rspec'
|
|
2
|
+
require 'rspec/core/warnings'
|
|
2
3
|
|
|
3
4
|
module Rspec
|
|
4
5
|
module Generators
|
|
5
6
|
# @private
|
|
6
7
|
class IntegrationGenerator < Base
|
|
7
|
-
# Add a deprecation for this class, before rspec-rails 4, to use the
|
|
8
|
-
# `RequestGenerator` instead
|
|
9
8
|
class_option :request_specs,
|
|
10
9
|
type: :boolean,
|
|
11
10
|
default: true,
|
|
12
11
|
desc: "Generate request specs"
|
|
13
12
|
|
|
13
|
+
source_paths << File.expand_path('../request/templates', __dir__)
|
|
14
|
+
|
|
14
15
|
def generate_request_spec
|
|
15
16
|
return unless options[:request_specs]
|
|
16
17
|
|
|
18
|
+
RSpec.warn_deprecation <<-WARNING.gsub(/\s*\|/, ' ')
|
|
19
|
+
|The integration generator is deprecated
|
|
20
|
+
|and will be deleted in RSpec-Rails 7.
|
|
21
|
+
|Please use the request generator instead.
|
|
22
|
+
WARNING
|
|
23
|
+
|
|
17
24
|
template 'request_spec.rb',
|
|
18
|
-
|
|
25
|
+
target_path('requests', "#{name.underscore.pluralize}_spec.rb")
|
|
19
26
|
end
|
|
20
27
|
end
|
|
21
28
|
end
|
|
@@ -6,7 +6,7 @@ module Rspec
|
|
|
6
6
|
class JobGenerator < Base
|
|
7
7
|
def create_job_spec
|
|
8
8
|
file_suffix = file_name.end_with?('job') ? 'spec.rb' : 'job_spec.rb'
|
|
9
|
-
template 'job_spec.rb.erb',
|
|
9
|
+
template 'job_spec.rb.erb', target_path('jobs', class_path, [file_name, file_suffix].join('_'))
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -6,7 +6,7 @@ module Rspec
|
|
|
6
6
|
class MailboxGenerator < Base
|
|
7
7
|
def create_mailbox_spec
|
|
8
8
|
template('mailbox_spec.rb.erb',
|
|
9
|
-
|
|
9
|
+
target_path('mailboxes', class_path, "#{file_name}_mailbox_spec.rb")
|
|
10
10
|
)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -8,20 +8,20 @@ module Rspec
|
|
|
8
8
|
argument :actions, type: :array, default: [], banner: "method method"
|
|
9
9
|
|
|
10
10
|
def generate_mailer_spec
|
|
11
|
-
template "mailer_spec.rb",
|
|
11
|
+
template "mailer_spec.rb", target_path('mailers', class_path, "#{file_name}_spec.rb")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def generate_fixtures_files
|
|
15
15
|
actions.each do |action|
|
|
16
16
|
@action, @path = action, File.join(file_path, action)
|
|
17
|
-
template "fixture",
|
|
17
|
+
template "fixture", target_path("fixtures", @path)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def generate_preview_files
|
|
22
22
|
return unless RSpec::Rails::FeatureCheck.has_action_mailer_preview?
|
|
23
23
|
|
|
24
|
-
template "preview.rb",
|
|
24
|
+
template "preview.rb", target_path("mailers/previews", class_path, "#{file_name}_preview.rb")
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -11,8 +11,8 @@ module Rspec
|
|
|
11
11
|
class_option :fixture, type: :boolean
|
|
12
12
|
|
|
13
13
|
def create_model_spec
|
|
14
|
-
template_file =
|
|
15
|
-
'
|
|
14
|
+
template_file = target_path(
|
|
15
|
+
'models',
|
|
16
16
|
class_path,
|
|
17
17
|
"#{file_name}_spec.rb"
|
|
18
18
|
)
|
|
@@ -24,7 +24,7 @@ module Rspec
|
|
|
24
24
|
def create_fixture_file
|
|
25
25
|
return unless missing_fixture_replacement?
|
|
26
26
|
|
|
27
|
-
template 'fixtures.yml',
|
|
27
|
+
template 'fixtures.yml', target_path('fixtures', class_path, "#{(pluralize_table_names? ? plural_file_name : file_name)}.yml")
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
private
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
require 'generators/rspec
|
|
1
|
+
require 'generators/rspec'
|
|
2
2
|
|
|
3
3
|
module Rspec
|
|
4
4
|
module Generators
|
|
5
5
|
# @private
|
|
6
|
-
class RequestGenerator <
|
|
7
|
-
|
|
6
|
+
class RequestGenerator < Base
|
|
7
|
+
class_option :request_specs, type: :boolean, default: true, desc: 'Generate request specs'
|
|
8
|
+
|
|
9
|
+
def generate_request_spec
|
|
10
|
+
return unless options[:request_specs]
|
|
11
|
+
|
|
12
|
+
template 'request_spec.rb',
|
|
13
|
+
target_path('requests', "#{name.underscore.pluralize}_spec.rb")
|
|
14
|
+
end
|
|
8
15
|
end
|
|
9
16
|
end
|
|
10
17
|
end
|
|
File without changes
|
|
@@ -58,8 +58,8 @@ module Rspec
|
|
|
58
58
|
def generate_routing_spec
|
|
59
59
|
return unless options[:routing_specs]
|
|
60
60
|
|
|
61
|
-
template_file =
|
|
62
|
-
'
|
|
61
|
+
template_file = target_path(
|
|
62
|
+
'routing',
|
|
63
63
|
controller_class_path,
|
|
64
64
|
"#{controller_file_name}_routing_spec.rb"
|
|
65
65
|
)
|
|
@@ -72,7 +72,7 @@ module Rspec
|
|
|
72
72
|
|
|
73
73
|
def copy_view(view)
|
|
74
74
|
template "#{view}_spec.rb",
|
|
75
|
-
|
|
75
|
+
target_path("views", controller_file_path, "#{view}.html.#{options[:template_engine]}_spec.rb")
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
# support for namespaced-resources
|
|
@@ -121,7 +121,7 @@ module Rspec
|
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
def template_file(folder:, suffix: '')
|
|
124
|
-
|
|
124
|
+
target_path(folder, controller_class_path, "#{controller_file_name}#{suffix}_spec.rb")
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def banner
|
|
@@ -90,10 +90,17 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
context "with invalid params" do
|
|
93
|
+
<% if Rails.version.to_f < 7.0 %>
|
|
93
94
|
it "returns a success response (i.e. to display the 'new' template)" do
|
|
94
95
|
post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
|
|
95
96
|
expect(response).to be_successful
|
|
96
97
|
end
|
|
98
|
+
<% else %>
|
|
99
|
+
it "renders a response with 422 status (i.e. to display the 'new' template)" do
|
|
100
|
+
post :create, params: {<%= singular_table_name %>: invalid_attributes}, session: valid_session
|
|
101
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
|
102
|
+
end
|
|
103
|
+
<% end %>
|
|
97
104
|
end
|
|
98
105
|
end
|
|
99
106
|
|
|
@@ -118,11 +125,19 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
|
118
125
|
end
|
|
119
126
|
|
|
120
127
|
context "with invalid params" do
|
|
128
|
+
<% if Rails.version.to_f < 7.0 %>
|
|
121
129
|
it "returns a success response (i.e. to display the 'edit' template)" do
|
|
122
130
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
|
123
131
|
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
|
|
124
132
|
expect(response).to be_successful
|
|
125
133
|
end
|
|
134
|
+
<% else %>
|
|
135
|
+
it "renders a response with 422 status (i.e. to display the 'edit' template)" do
|
|
136
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
|
137
|
+
put :update, params: {id: <%= file_name %>.to_param, <%= singular_table_name %>: invalid_attributes}, session: valid_session
|
|
138
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
|
139
|
+
end
|
|
140
|
+
<% end %>
|
|
126
141
|
end
|
|
127
142
|
end
|
|
128
143
|
|
|
@@ -2,18 +2,22 @@ require 'rails_helper'
|
|
|
2
2
|
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
|
4
4
|
RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let(:<%= ns_file_name %>) {
|
|
6
|
+
<%= class_name %>.create!(<%= ')' if output_attributes.empty? %>
|
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
|
8
8
|
<%= attribute.name %>: <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
|
9
9
|
<% end -%>
|
|
10
|
-
<%=
|
|
10
|
+
<%= " )\n" unless output_attributes.empty? -%>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
before(:each) do
|
|
14
|
+
assign(:<%= ns_file_name %>, <%= ns_file_name %>)
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
it "renders the edit <%= ns_file_name %> form" do
|
|
14
18
|
render
|
|
15
19
|
|
|
16
|
-
assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(
|
|
20
|
+
assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(<%= ns_file_name %>), "post" do
|
|
17
21
|
<% for attribute in output_attributes -%>
|
|
18
22
|
<%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
|
|
19
23
|
assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
|
@@ -18,8 +18,9 @@ RSpec.describe "<%= ns_table_name %>/index", <%= type_metatag(:view) %> do
|
|
|
18
18
|
|
|
19
19
|
it "renders a list of <%= ns_table_name %>" do
|
|
20
20
|
render
|
|
21
|
+
cell_selector = Rails::VERSION::STRING >= '7' ? 'div>p' : 'tr>td'
|
|
21
22
|
<% for attribute in output_attributes -%>
|
|
22
|
-
assert_select
|
|
23
|
+
assert_select cell_selector, text: Regexp.new(<%= value_for(attribute) %>.to_s), count: 2
|
|
23
24
|
<% end -%>
|
|
24
25
|
end
|
|
25
26
|
end
|
|
@@ -83,10 +83,17 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
|
|
|
83
83
|
}.to change(<%= class_name %>, :count).by(0)
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
<% if Rails.version.to_f < 7.0 %>
|
|
86
87
|
it "renders a successful response (i.e. to display the 'new' template)" do
|
|
87
88
|
post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes }
|
|
88
89
|
expect(response).to be_successful
|
|
89
90
|
end
|
|
91
|
+
<% else %>
|
|
92
|
+
it "renders a response with 422 status (i.e. to display the 'new' template)" do
|
|
93
|
+
post <%= index_helper %>_url, params: { <%= singular_table_name %>: invalid_attributes }
|
|
94
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
|
95
|
+
end
|
|
96
|
+
<% end %>
|
|
90
97
|
end
|
|
91
98
|
end
|
|
92
99
|
|
|
@@ -112,11 +119,19 @@ RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %
|
|
|
112
119
|
end
|
|
113
120
|
|
|
114
121
|
context "with invalid parameters" do
|
|
122
|
+
<% if Rails.version.to_f < 7.0 %>
|
|
115
123
|
it "renders a successful response (i.e. to display the 'edit' template)" do
|
|
116
124
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
|
117
125
|
patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }
|
|
118
126
|
expect(response).to be_successful
|
|
119
127
|
end
|
|
128
|
+
<% else %>
|
|
129
|
+
it "renders a response with 422 status (i.e. to display the 'edit' template)" do
|
|
130
|
+
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
|
131
|
+
patch <%= show_helper %>, params: { <%= singular_table_name %>: invalid_attributes }
|
|
132
|
+
expect(response).to have_http_status(:unprocessable_entity)
|
|
133
|
+
end
|
|
134
|
+
<% end %>
|
|
120
135
|
end
|
|
121
136
|
end
|
|
122
137
|
|
|
@@ -3,7 +3,7 @@ require 'rails_helper'
|
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
|
4
4
|
RSpec.describe "<%= ns_table_name %>/show", <%= type_metatag(:view) %> do
|
|
5
5
|
before(:each) do
|
|
6
|
-
|
|
6
|
+
assign(:<%= ns_file_name %>, <%= class_name %>.create!(<%= '))' if output_attributes.empty? %>
|
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
|
8
8
|
<%= attribute.name %>: <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
|
9
9
|
<% end -%>
|
|
@@ -9,12 +9,12 @@ module Rspec
|
|
|
9
9
|
class_option :template_engine, desc: "Template engine to generate view files"
|
|
10
10
|
|
|
11
11
|
def create_view_specs
|
|
12
|
-
empty_directory
|
|
12
|
+
empty_directory target_path("views", file_path)
|
|
13
13
|
|
|
14
14
|
actions.each do |action|
|
|
15
15
|
@action = action
|
|
16
16
|
template 'view_spec.rb',
|
|
17
|
-
|
|
17
|
+
target_path("views", file_path, "#{@action}.html.#{options[:template_engine]}_spec.rb")
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
data/lib/generators/rspec.rb
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
require 'rails/generators/named_base'
|
|
2
|
+
require 'rspec/core'
|
|
2
3
|
require 'rspec/rails/feature_check'
|
|
3
4
|
|
|
4
5
|
# @private
|
|
5
|
-
# Weirdly named generators namespace (should be `RSpec`) for
|
|
6
|
+
# Weirdly named generators namespace (should be `RSpec`) for compatibility with
|
|
6
7
|
# rails loading.
|
|
7
8
|
module Rspec
|
|
8
9
|
# @private
|
|
@@ -18,6 +19,22 @@ module Rspec
|
|
|
18
19
|
@_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
|
|
19
20
|
end
|
|
20
21
|
end
|
|
22
|
+
|
|
23
|
+
# @private
|
|
24
|
+
# Load configuration from RSpec to ensure `--default-path` is set
|
|
25
|
+
def self.configuration
|
|
26
|
+
@configuration ||=
|
|
27
|
+
begin
|
|
28
|
+
configuration = RSpec.configuration
|
|
29
|
+
options = RSpec::Core::ConfigurationOptions.new({})
|
|
30
|
+
options.configure(configuration)
|
|
31
|
+
configuration
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def target_path(*paths)
|
|
36
|
+
File.join(self.class.configuration.default_path, *paths)
|
|
37
|
+
end
|
|
21
38
|
end
|
|
22
39
|
end
|
|
23
40
|
end
|
data/lib/rspec/rails/adapters.rb
CHANGED
|
@@ -181,5 +181,16 @@ module RSpec
|
|
|
181
181
|
#
|
|
182
182
|
# @private
|
|
183
183
|
TestUnitAssertionAdapter = MinitestAssertionAdapter
|
|
184
|
+
|
|
185
|
+
# @private
|
|
186
|
+
module TaggedLoggingAdapter
|
|
187
|
+
private
|
|
188
|
+
# Vendored from activesupport/lib/active_support/testing/tagged_logging.rb
|
|
189
|
+
# This implements the tagged_logger method where it is expected, but
|
|
190
|
+
# doesn't call `name` or set it up like Rails does.
|
|
191
|
+
def tagged_logger
|
|
192
|
+
@tagged_logger ||= (defined?(Rails.logger) && Rails.logger)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
184
195
|
end
|
|
185
196
|
end
|
|
@@ -26,19 +26,19 @@ module RSpec
|
|
|
26
26
|
#
|
|
27
27
|
# @api private
|
|
28
28
|
DIRECTORY_MAPPINGS = {
|
|
29
|
-
channel:
|
|
29
|
+
channel: %w[spec channels],
|
|
30
30
|
controller: %w[spec controllers],
|
|
31
|
-
generator:
|
|
32
|
-
helper:
|
|
33
|
-
job:
|
|
34
|
-
mailer:
|
|
35
|
-
model:
|
|
36
|
-
request:
|
|
37
|
-
routing:
|
|
38
|
-
view:
|
|
39
|
-
feature:
|
|
40
|
-
system:
|
|
41
|
-
mailbox:
|
|
31
|
+
generator: %w[spec generator],
|
|
32
|
+
helper: %w[spec helpers],
|
|
33
|
+
job: %w[spec jobs],
|
|
34
|
+
mailer: %w[spec mailers],
|
|
35
|
+
model: %w[spec models],
|
|
36
|
+
request: %w[spec (requests|integration|api)],
|
|
37
|
+
routing: %w[spec routing],
|
|
38
|
+
view: %w[spec views],
|
|
39
|
+
feature: %w[spec features],
|
|
40
|
+
system: %w[spec system],
|
|
41
|
+
mailbox: %w[spec mailboxes]
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
# Sets up the different example group modules for the different spec types
|
|
@@ -54,23 +54,22 @@ module RSpec
|
|
|
54
54
|
ActionDispatch::SystemTesting::Server.silence_puma = true
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
+
require 'action_dispatch/system_test_case'
|
|
58
|
+
|
|
57
59
|
begin
|
|
58
60
|
require 'capybara'
|
|
59
|
-
require 'action_dispatch/system_test_case'
|
|
60
61
|
rescue LoadError => e
|
|
61
62
|
abort """
|
|
62
63
|
LoadError: #{e.message}
|
|
63
|
-
System test integration
|
|
64
|
+
System test integration has a hard
|
|
64
65
|
dependency on a webserver and `capybara`, please add capybara to
|
|
65
66
|
your Gemfile and configure a webserver (e.g. `Capybara.server =
|
|
66
|
-
:
|
|
67
|
+
:puma`) before attempting to use system specs.
|
|
67
68
|
""".gsub(/\s+/, ' ').strip
|
|
68
69
|
end
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown.instance_method(:before_teardown)
|
|
73
|
-
end
|
|
71
|
+
original_before_teardown =
|
|
72
|
+
::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown.instance_method(:before_teardown)
|
|
74
73
|
|
|
75
74
|
original_after_teardown =
|
|
76
75
|
::ActionDispatch::SystemTesting::TestHelpers::SetupAndTeardown.instance_method(:after_teardown)
|
|
@@ -108,10 +107,7 @@ module RSpec
|
|
|
108
107
|
orig_stdout = $stdout
|
|
109
108
|
$stdout = StringIO.new
|
|
110
109
|
begin
|
|
111
|
-
|
|
112
|
-
original_before_teardown.bind(self).call
|
|
113
|
-
end
|
|
114
|
-
original_after_teardown.bind(self).call
|
|
110
|
+
original_before_teardown.bind(self).call
|
|
115
111
|
ensure
|
|
116
112
|
myio = $stdout
|
|
117
113
|
myio.rewind
|
|
@@ -119,6 +115,11 @@ module RSpec
|
|
|
119
115
|
$stdout = orig_stdout
|
|
120
116
|
end
|
|
121
117
|
end
|
|
118
|
+
|
|
119
|
+
around do |example|
|
|
120
|
+
example.run
|
|
121
|
+
original_after_teardown.bind(self).call
|
|
122
|
+
end
|
|
122
123
|
end
|
|
123
124
|
end
|
|
124
125
|
end
|
|
@@ -149,11 +149,11 @@ module RSpec
|
|
|
149
149
|
# the original string.
|
|
150
150
|
match = path_regex.match(_default_file_to_render)
|
|
151
151
|
|
|
152
|
-
render_options = {template: match[:template]}
|
|
153
|
-
render_options[:handlers] = [match[:handler]] if match[:handler]
|
|
152
|
+
render_options = { template: match[:template] }
|
|
153
|
+
render_options[:handlers] = [match[:handler].to_sym] if match[:handler]
|
|
154
154
|
render_options[:formats] = [match[:format].to_sym] if match[:format]
|
|
155
|
-
render_options[:locales] = [match[:locale]] if match[:locale]
|
|
156
|
-
render_options[:variants] = [match[:variant]] if match[:variant]
|
|
155
|
+
render_options[:locales] = [match[:locale].to_sym] if match[:locale]
|
|
156
|
+
render_options[:variants] = [match[:variant].to_sym] if match[:variant]
|
|
157
157
|
|
|
158
158
|
render_options
|
|
159
159
|
end
|
|
@@ -24,17 +24,21 @@ module RSpec
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def has_action_cable_testing?
|
|
27
|
-
defined?(::ActionCable)
|
|
27
|
+
defined?(::ActionCable)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def has_action_mailer_parameterized?
|
|
31
|
-
has_action_mailer? && defined?(::ActionMailer::Parameterized)
|
|
31
|
+
has_action_mailer? && defined?(::ActionMailer::Parameterized::DeliveryJob)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def has_action_mailer_unified_delivery?
|
|
35
35
|
has_action_mailer? && defined?(::ActionMailer::MailDeliveryJob)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def has_action_mailer_legacy_delivery_job?
|
|
39
|
+
defined?(ActionMailer::DeliveryJob)
|
|
40
|
+
end
|
|
41
|
+
|
|
38
42
|
def has_action_mailbox?
|
|
39
43
|
defined?(::ActionMailbox)
|
|
40
44
|
end
|
|
@@ -6,41 +6,24 @@ module RSpec
|
|
|
6
6
|
|
|
7
7
|
private
|
|
8
8
|
|
|
9
|
-
# In Rails
|
|
10
|
-
# was brought in with a deprecation warning on 6.1. In Rails
|
|
9
|
+
# In Rails 7.0 fixture file path needs to be relative to `file_fixture_path` instead, this change
|
|
10
|
+
# was brought in with a deprecation warning on 6.1. In Rails 7.0 expect to rework this to remove
|
|
11
11
|
# the old accessor.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
RailsFixtureFileWrapper.instance
|
|
23
|
-
end
|
|
24
|
-
else
|
|
25
|
-
def rails_fixture_file_wrapper
|
|
26
|
-
RailsFixtureFileWrapper.fixture_path = nil
|
|
27
|
-
resolved_fixture_path =
|
|
28
|
-
if respond_to?(:fixture_path) && !fixture_path.nil?
|
|
29
|
-
fixture_path.to_s
|
|
30
|
-
else
|
|
31
|
-
(RSpec.configuration.fixture_path || '').to_s
|
|
32
|
-
end
|
|
33
|
-
RailsFixtureFileWrapper.fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty?
|
|
34
|
-
RailsFixtureFileWrapper.instance
|
|
35
|
-
end
|
|
12
|
+
def rails_fixture_file_wrapper
|
|
13
|
+
RailsFixtureFileWrapper.file_fixture_path = nil
|
|
14
|
+
resolved_fixture_path =
|
|
15
|
+
if respond_to?(:file_fixture_path) && !file_fixture_path.nil?
|
|
16
|
+
file_fixture_path.to_s
|
|
17
|
+
else
|
|
18
|
+
(RSpec.configuration.fixture_path || '').to_s
|
|
19
|
+
end
|
|
20
|
+
RailsFixtureFileWrapper.file_fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty?
|
|
21
|
+
RailsFixtureFileWrapper.instance
|
|
36
22
|
end
|
|
37
23
|
|
|
38
24
|
class RailsFixtureFileWrapper
|
|
39
25
|
include ActionDispatch::TestProcess if defined?(ActionDispatch::TestProcess)
|
|
40
|
-
|
|
41
|
-
if ::Rails.version.to_f >= 6.1
|
|
42
|
-
include ActiveSupport::Testing::FileFixtures
|
|
43
|
-
end
|
|
26
|
+
include ActiveSupport::Testing::FileFixtures
|
|
44
27
|
|
|
45
28
|
class << self
|
|
46
29
|
attr_accessor :fixture_path
|
|
@@ -46,7 +46,7 @@ module RSpec
|
|
|
46
46
|
def proxy_method_warning_if_called_in_before_context_scope(method_name)
|
|
47
47
|
orig_implementation = instance_method(method_name)
|
|
48
48
|
define_method(method_name) do |*args, &blk|
|
|
49
|
-
if
|
|
49
|
+
if RSpec.current_scope == :before_context_hook
|
|
50
50
|
RSpec.warn_with("Calling fixture method in before :context ")
|
|
51
51
|
else
|
|
52
52
|
orig_implementation.bind(self).call(*args, &blk)
|
|
@@ -159,7 +159,7 @@ module RSpec
|
|
|
159
159
|
def check_channel_presence
|
|
160
160
|
return if @channel.present? && @channel.respond_to?(:channel_name)
|
|
161
161
|
|
|
162
|
-
error_msg = "Broadcasting channel can't be
|
|
162
|
+
error_msg = "Broadcasting channel can't be inferred. Please, specify it with `from_channel`"
|
|
163
163
|
raise ArgumentError, error_msg
|
|
164
164
|
end
|
|
165
165
|
end
|
|
@@ -181,7 +181,7 @@ module RSpec
|
|
|
181
181
|
|`Time.current.change(usec: 0)`
|
|
182
182
|
|
|
|
183
183
|
|Note: RSpec cannot do this for you because jobs can be scheduled with usec
|
|
184
|
-
|precision and we do not know
|
|
184
|
+
|precision and we do not know whether it is on purpose or not.
|
|
185
185
|
|
|
|
186
186
|
|
|
|
187
187
|
WARNING
|
|
@@ -134,7 +134,7 @@ module RSpec
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
# Ruby 3.1 changed how params were serialized on Rails 6.1
|
|
137
|
-
# so we override the active job implementation and
|
|
137
|
+
# so we override the active job implementation and customize it here.
|
|
138
138
|
def deserialize_arguments(job)
|
|
139
139
|
args = super
|
|
140
140
|
|
|
@@ -158,7 +158,7 @@ module RSpec
|
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def legacy_mail?(job)
|
|
161
|
-
job[:job] <= ActionMailer::DeliveryJob
|
|
161
|
+
RSpec::Rails::FeatureCheck.has_action_mailer_legacy_delivery_job? && job[:job] <= ActionMailer::DeliveryJob
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
def parameterized_mail?(job)
|
|
@@ -169,6 +169,7 @@ module RSpec
|
|
|
169
169
|
RSpec::Rails::FeatureCheck.has_action_mailer_unified_delivery? && job[:job] <= ActionMailer::MailDeliveryJob
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
|
+
|
|
172
173
|
# @api public
|
|
173
174
|
# Passes if an email has been enqueued inside block.
|
|
174
175
|
# May chain with to specify expected arguments.
|
|
@@ -305,7 +305,7 @@ module RSpec
|
|
|
305
305
|
|
|
306
306
|
private
|
|
307
307
|
|
|
308
|
-
# @return [String]
|
|
308
|
+
# @return [String] formatting the expected status and associated code(s)
|
|
309
309
|
def type_message
|
|
310
310
|
@type_message ||= (expected == :error ? "an error" : "a #{expected}") +
|
|
311
311
|
" status code (#{type_codes})"
|
|
@@ -26,7 +26,7 @@ module RSpec
|
|
|
26
26
|
path, query = *verb_to_path_map.values.first.split('?')
|
|
27
27
|
@scope.assert_recognizes(
|
|
28
28
|
@expected,
|
|
29
|
-
{method: verb_to_path_map.keys.first, path: path},
|
|
29
|
+
{ method: verb_to_path_map.keys.first, path: path },
|
|
30
30
|
Rack::Utils.parse_nested_query(query)
|
|
31
31
|
)
|
|
32
32
|
end
|
|
@@ -115,7 +115,7 @@ module RSpec
|
|
|
115
115
|
# Shorthand method for matching this type of route.
|
|
116
116
|
%w[get post put patch delete options head].each do |method|
|
|
117
117
|
define_method method do |path|
|
|
118
|
-
{method.to_sym => path}
|
|
118
|
+
{ method.to_sym => path }
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
end
|
|
@@ -12,9 +12,7 @@ if defined?(Capybara)
|
|
|
12
12
|
RSpec.configure do |c|
|
|
13
13
|
if defined?(Capybara::DSL)
|
|
14
14
|
c.include Capybara::DSL, type: :feature
|
|
15
|
-
|
|
16
|
-
c.include Capybara::DSL, type: :system
|
|
17
|
-
end
|
|
15
|
+
c.include Capybara::DSL, type: :system
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
if defined?(Capybara::RSpecMatchers)
|
data/lib/rspec/rails/version.rb
CHANGED
|
@@ -13,26 +13,8 @@ module RSpec
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# Compat-shim for AbstractController::Rendering#view_assigns
|
|
16
|
-
#
|
|
17
|
-
# _assigns was deprecated in favor of view_assigns after
|
|
18
|
-
# Rails-3.0.0 was released. Since we are not able to predict when
|
|
19
|
-
# the _assigns/view_assigns patch will be released (I thought it
|
|
20
|
-
# would have been in 3.0.1, but 3.0.1 bypassed this change for a
|
|
21
|
-
# security fix), this bit ensures that we do the right thing without
|
|
22
|
-
# knowing anything about the Rails version we are dealing with.
|
|
23
|
-
#
|
|
24
|
-
# Once that change _is_ released, this can be changed to something
|
|
25
|
-
# that checks for the Rails version when the module is being
|
|
26
|
-
# interpreted, as it was before commit dd0095.
|
|
27
16
|
def view_assigns
|
|
28
17
|
super.merge(_encapsulated_assigns)
|
|
29
|
-
rescue
|
|
30
|
-
_assigns
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# @private
|
|
34
|
-
def _assigns
|
|
35
|
-
super.merge(_encapsulated_assigns)
|
|
36
18
|
end
|
|
37
19
|
|
|
38
20
|
private
|
|
@@ -62,14 +62,8 @@ module RSpec
|
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
template.format
|
|
68
|
-
end
|
|
69
|
-
else
|
|
70
|
-
def self.template_format(template)
|
|
71
|
-
template.formats
|
|
72
|
-
end
|
|
65
|
+
def self.template_format(template)
|
|
66
|
+
template.format
|
|
73
67
|
end
|
|
74
68
|
|
|
75
69
|
# Delegates all methods to the submitted resolver and for all methods
|
data/lib/rspec-rails.rb
CHANGED
|
@@ -8,11 +8,7 @@ module RSpec
|
|
|
8
8
|
class Railtie < ::Rails::Railtie
|
|
9
9
|
# As of Rails 5.1.0 you can register directories to work with `rake notes`
|
|
10
10
|
require 'rails/source_annotation_extractor'
|
|
11
|
-
|
|
12
|
-
::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec")
|
|
13
|
-
else
|
|
14
|
-
SourceAnnotationExtractor::Annotation.register_directories("spec")
|
|
15
|
-
end
|
|
11
|
+
::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec")
|
|
16
12
|
generators = config.app_generators
|
|
17
13
|
generators.integration_tool :rspec
|
|
18
14
|
generators.test_framework :rspec
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Chelimsky
|
|
@@ -44,7 +44,7 @@ cert_chain:
|
|
|
44
44
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
|
45
45
|
F3MdtaDehhjC
|
|
46
46
|
-----END CERTIFICATE-----
|
|
47
|
-
date: 2022-
|
|
47
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
|
48
48
|
dependencies:
|
|
49
49
|
- !ruby/object:Gem::Dependency
|
|
50
50
|
name: actionpack
|
|
@@ -52,98 +52,98 @@ dependencies:
|
|
|
52
52
|
requirements:
|
|
53
53
|
- - ">="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version: '
|
|
55
|
+
version: '6.1'
|
|
56
56
|
type: :runtime
|
|
57
57
|
prerelease: false
|
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
|
59
59
|
requirements:
|
|
60
60
|
- - ">="
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: '
|
|
62
|
+
version: '6.1'
|
|
63
63
|
- !ruby/object:Gem::Dependency
|
|
64
64
|
name: activesupport
|
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - ">="
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '
|
|
69
|
+
version: '6.1'
|
|
70
70
|
type: :runtime
|
|
71
71
|
prerelease: false
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
73
|
requirements:
|
|
74
74
|
- - ">="
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '
|
|
76
|
+
version: '6.1'
|
|
77
77
|
- !ruby/object:Gem::Dependency
|
|
78
78
|
name: railties
|
|
79
79
|
requirement: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
81
|
- - ">="
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '
|
|
83
|
+
version: '6.1'
|
|
84
84
|
type: :runtime
|
|
85
85
|
prerelease: false
|
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: '
|
|
90
|
+
version: '6.1'
|
|
91
91
|
- !ruby/object:Gem::Dependency
|
|
92
92
|
name: rspec-core
|
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
95
|
- - "~>"
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: '3.
|
|
97
|
+
version: '3.11'
|
|
98
98
|
type: :runtime
|
|
99
99
|
prerelease: false
|
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
|
102
102
|
- - "~>"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '3.
|
|
104
|
+
version: '3.11'
|
|
105
105
|
- !ruby/object:Gem::Dependency
|
|
106
106
|
name: rspec-expectations
|
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
|
109
109
|
- - "~>"
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
|
-
version: '3.
|
|
111
|
+
version: '3.11'
|
|
112
112
|
type: :runtime
|
|
113
113
|
prerelease: false
|
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
|
115
115
|
requirements:
|
|
116
116
|
- - "~>"
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
|
-
version: '3.
|
|
118
|
+
version: '3.11'
|
|
119
119
|
- !ruby/object:Gem::Dependency
|
|
120
120
|
name: rspec-mocks
|
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
|
122
122
|
requirements:
|
|
123
123
|
- - "~>"
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
|
-
version: '3.
|
|
125
|
+
version: '3.11'
|
|
126
126
|
type: :runtime
|
|
127
127
|
prerelease: false
|
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
|
130
130
|
- - "~>"
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
version: '3.
|
|
132
|
+
version: '3.11'
|
|
133
133
|
- !ruby/object:Gem::Dependency
|
|
134
134
|
name: rspec-support
|
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
|
136
136
|
requirements:
|
|
137
137
|
- - "~>"
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: '3.
|
|
139
|
+
version: '3.11'
|
|
140
140
|
type: :runtime
|
|
141
141
|
prerelease: false
|
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
|
143
143
|
requirements:
|
|
144
144
|
- - "~>"
|
|
145
145
|
- !ruby/object:Gem::Version
|
|
146
|
-
version: '3.
|
|
146
|
+
version: '3.11'
|
|
147
147
|
- !ruby/object:Gem::Dependency
|
|
148
148
|
name: ammeter
|
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -176,28 +176,16 @@ dependencies:
|
|
|
176
176
|
name: cucumber
|
|
177
177
|
requirement: !ruby/object:Gem::Requirement
|
|
178
178
|
requirements:
|
|
179
|
-
- - "
|
|
180
|
-
- !ruby/object:Gem::Version
|
|
181
|
-
version: '3.2'
|
|
182
|
-
- - "!="
|
|
183
|
-
- !ruby/object:Gem::Version
|
|
184
|
-
version: 4.0.0
|
|
185
|
-
- - "<"
|
|
179
|
+
- - "~>"
|
|
186
180
|
- !ruby/object:Gem::Version
|
|
187
|
-
version:
|
|
181
|
+
version: '7.0'
|
|
188
182
|
type: :development
|
|
189
183
|
prerelease: false
|
|
190
184
|
version_requirements: !ruby/object:Gem::Requirement
|
|
191
185
|
requirements:
|
|
192
|
-
- - "
|
|
193
|
-
- !ruby/object:Gem::Version
|
|
194
|
-
version: '3.2'
|
|
195
|
-
- - "!="
|
|
196
|
-
- !ruby/object:Gem::Version
|
|
197
|
-
version: 4.0.0
|
|
198
|
-
- - "<"
|
|
186
|
+
- - "~>"
|
|
199
187
|
- !ruby/object:Gem::Version
|
|
200
|
-
version:
|
|
188
|
+
version: '7.0'
|
|
201
189
|
description: rspec-rails is a testing framework for Rails 5+.
|
|
202
190
|
email: rspec@googlegroups.com
|
|
203
191
|
executables: []
|
|
@@ -228,7 +216,6 @@ files:
|
|
|
228
216
|
- lib/generators/rspec/install/install_generator.rb
|
|
229
217
|
- lib/generators/rspec/install/templates/spec/rails_helper.rb
|
|
230
218
|
- lib/generators/rspec/integration/integration_generator.rb
|
|
231
|
-
- lib/generators/rspec/integration/templates/request_spec.rb
|
|
232
219
|
- lib/generators/rspec/job/job_generator.rb
|
|
233
220
|
- lib/generators/rspec/job/templates/job_spec.rb.erb
|
|
234
221
|
- lib/generators/rspec/mailbox/mailbox_generator.rb
|
|
@@ -241,6 +228,7 @@ files:
|
|
|
241
228
|
- lib/generators/rspec/model/templates/fixtures.yml
|
|
242
229
|
- lib/generators/rspec/model/templates/model_spec.rb
|
|
243
230
|
- lib/generators/rspec/request/request_generator.rb
|
|
231
|
+
- lib/generators/rspec/request/templates/request_spec.rb
|
|
244
232
|
- lib/generators/rspec/scaffold/scaffold_generator.rb
|
|
245
233
|
- lib/generators/rspec/scaffold/templates/api_controller_spec.rb
|
|
246
234
|
- lib/generators/rspec/scaffold/templates/api_request_spec.rb
|
|
@@ -308,7 +296,7 @@ licenses:
|
|
|
308
296
|
- MIT
|
|
309
297
|
metadata:
|
|
310
298
|
bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
|
|
311
|
-
changelog_uri: https://github.com/rspec/rspec-rails/blob/
|
|
299
|
+
changelog_uri: https://github.com/rspec/rspec-rails/blob/v6.0.1/Changelog.md
|
|
312
300
|
documentation_uri: https://rspec.info/documentation/
|
|
313
301
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
|
314
302
|
source_code_uri: https://github.com/rspec/rspec-rails
|
|
@@ -321,7 +309,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
321
309
|
requirements:
|
|
322
310
|
- - ">="
|
|
323
311
|
- !ruby/object:Gem::Version
|
|
324
|
-
version: 2.
|
|
312
|
+
version: 2.5.0
|
|
325
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
314
|
requirements:
|
|
327
315
|
- - ">="
|
metadata.gz.sig
CHANGED
|
Binary file
|