rspec-rails 4.1.1 → 5.0.2
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.tar.gz.sig +0 -0
- data/Changelog.md +38 -2
- data/README.md +5 -3
- data/lib/generators/rspec/job/job_generator.rb +2 -1
- data/lib/generators/rspec/job/templates/job_spec.rb.erb +1 -1
- data/lib/generators/rspec/mailer/templates/mailer_spec.rb +2 -2
- data/lib/generators/rspec/mailer/templates/preview.rb +1 -1
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +0 -48
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +0 -4
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +0 -4
- data/lib/generators/rspec/system/system_generator.rb +14 -16
- data/lib/rspec-rails.rb +5 -7
- data/lib/rspec/rails/configuration.rb +2 -4
- data/lib/rspec/rails/example/controller_example_group.rb +1 -0
- data/lib/rspec/rails/example/request_example_group.rb +1 -4
- data/lib/rspec/rails/example/system_example_group.rb +1 -1
- data/lib/rspec/rails/file_fixture_support.rb +9 -11
- data/lib/rspec/rails/fixture_file_upload_support.rb +31 -10
- data/lib/rspec/rails/fixture_support.rb +3 -6
- data/lib/rspec/rails/matchers/action_mailbox.rb +14 -5
- data/lib/rspec/rails/version.rb +1 -1
- metadata +10 -10
- metadata.gz.sig +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93e1ee0dc7bb7ea05c19308593f872702af96d6964061a741151eee2e872109a
|
4
|
+
data.tar.gz: d76331ed70af267b4ff35ddb4479a470befe5dc54aaf2e07611cc7696873dbd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d5f6b9db91c30e791d85446ddcacd6ace734888c08141d4ccc120e3132c81113c67372bdac08c6b46b71f963e4510cdac55fad734e09fb4fc4ad205c59584c9
|
7
|
+
data.tar.gz: 9c61a0d38958a2ce62828bc75acb48ba81c16098a65ecc19bc778d0ec962b886163b41d257a096f23a84b99c022dbbe2c1d4435ffe948c2048604e001e7e4bdf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
### Development
|
2
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.2...5-0-maintenance)
|
3
|
+
|
4
|
+
### 5.0.2 / 2021-08-14
|
5
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.1...v5.0.2)
|
6
|
+
|
7
|
+
Bug Fixes:
|
8
|
+
|
9
|
+
* Prevent generated job specs from duplicating `_job` in filenames.
|
10
|
+
(Nick Flückiger, #2496)
|
11
|
+
* Fix `ActiveRecord::TestFixture#uses_transaction` by using example description
|
12
|
+
to replace example name rather than example in our monkey patched
|
13
|
+
`run_in_transaction?` method. (Stan Lo, #2495)
|
14
|
+
* Prevent keyword arguments being lost when methods are invoked dynamically
|
15
|
+
in controller specs. (Josh Cheek, #2509, #2514)
|
16
|
+
|
17
|
+
### 5.0.1 / 2021-03-18
|
18
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v5.0.0...v5.0.1)
|
19
|
+
|
20
|
+
Bug Fixes:
|
21
|
+
|
22
|
+
* Limit multibyte example descriptions when used in system tests for #method_name
|
23
|
+
which ends up as screenshot names etc. (@y-yagi, #2405, #2487)
|
24
|
+
|
25
|
+
### 5.0.0 / 2021-03-09
|
26
|
+
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.1.1...v5.0.0)
|
27
|
+
|
28
|
+
Enhancements:
|
29
|
+
|
30
|
+
* Support new #file_fixture_path and new fixture test support code. (Jon Rowe, #2398)
|
31
|
+
* Support for Rails 6.1. (Benoit Tigeot, Jon Rowe, Phil Pirozhkov, and more #2398)
|
32
|
+
|
33
|
+
Breaking Changes:
|
34
|
+
|
35
|
+
* Drop support for Rails below 5.2.
|
36
|
+
|
1
37
|
### 4.1.1 / 2021-03-09
|
2
38
|
|
3
39
|
Bug Fixes:
|
@@ -6,7 +42,6 @@ Bug Fixes:
|
|
6
42
|
(@Naokimi, #2475)
|
7
43
|
|
8
44
|
### 4.1.0 / 2021-03-06
|
9
|
-
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.2...v4.1.0)
|
10
45
|
|
11
46
|
Enhancements:
|
12
47
|
|
@@ -33,6 +68,7 @@ Bug Fixes:
|
|
33
68
|
(Phil Pirozhkov, Jon Rowe, #2353, #2354)
|
34
69
|
* Remove old #fixture_path feature detection code which broke under newer Rails.
|
35
70
|
(Koen Punt, Jon Rowe, #2370)
|
71
|
+
* Fix an error when `use_active_record` is `false` (Phil Pirozhkov, #2423)
|
36
72
|
|
37
73
|
### 4.0.1 / 2020-05-16
|
38
74
|
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0...v4.0.1)
|
@@ -70,7 +106,7 @@ Enhancements:
|
|
70
106
|
generating a controller (Luka Lüdicke, #2222)
|
71
107
|
* Allow `ActiveJob` matchers `#on_queue` modifier to take symbolic queue names. (Nils Sommer, #2283)
|
72
108
|
* The scaffold generator now generates request specs in preference to controller specs.
|
73
|
-
(Luka
|
109
|
+
(Luka Lüdicke, #2288)
|
74
110
|
* Add configuration option to disable ActiveRecord. (Jon Rowe, Phil Pirozhkov, Hermann Mayer, #2266)
|
75
111
|
* Set `ActionDispatch::SystemTesting::Server.silence_puma = true` when running system specs.
|
76
112
|
(ta1kt0me, Benoit Tigeot, #2289)
|
data/README.md
CHANGED
@@ -8,6 +8,7 @@ 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` 4.x][]** for Rails from 5.0 to 6.0.
|
11
12
|
Use **[`rspec-rails` 3.x][]** for Rails earlier than 5.0.
|
12
13
|
Use **[`rspec-rails` 1.x][]** for Rails 2.x.
|
13
14
|
|
@@ -21,19 +22,20 @@ Use **[`rspec-rails` 1.x][]** for Rails 2.x.
|
|
21
22
|
[Ruby on Rails]: https://rubyonrails.org/
|
22
23
|
[`rspec-rails` 1.x]: https://github.com/dchelimsky/rspec-rails
|
23
24
|
[`rspec-rails` 3.x]: https://github.com/rspec/rspec-rails/tree/3-9-maintenance
|
25
|
+
[`rspec-rails` 4.x]: https://github.com/rspec/rspec-rails/tree/4-1-maintenance
|
24
26
|
|
25
27
|
## Installation
|
26
28
|
|
27
|
-
**IMPORTANT** This README / branch refers to the
|
29
|
+
**IMPORTANT** This README / branch refers to the 5.0.x series of releases.
|
28
30
|
See the [`main` branch on Github](https://github.com/rspec/rspec-rails/tree/main) for more up to date releases.
|
29
31
|
|
30
32
|
1. Add `rspec-rails` to **both** the `:development` and `:test` groups
|
31
33
|
of your app’s `Gemfile`:
|
32
34
|
|
33
35
|
```ruby
|
34
|
-
# Run against
|
36
|
+
# Run against this stable release
|
35
37
|
group :development, :test do
|
36
|
-
gem 'rspec-rails', '~>
|
38
|
+
gem 'rspec-rails', '~> 5.0.0'
|
37
39
|
end
|
38
40
|
|
39
41
|
# Or, run against the main branch
|
@@ -5,7 +5,8 @@ module Rspec
|
|
5
5
|
# @private
|
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', File.join('spec/jobs', class_path, [file_name, file_suffix].join('_'))
|
9
10
|
end
|
10
11
|
end
|
11
12
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
|
-
RSpec.describe <%= class_name
|
4
|
+
RSpec.describe <%= class_name %><%= "Job" unless class_name.end_with?("Job")%>, <%= type_metatag(:job) %> do
|
5
5
|
pending "add some examples to (or delete) #{__FILE__}"
|
6
6
|
end
|
7
7
|
<% end -%>
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
3
|
<% module_namespacing do -%>
|
4
|
-
RSpec.describe <%=
|
4
|
+
RSpec.describe <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>, <%= type_metatag(:mailer) %> do
|
5
5
|
<% for action in actions -%>
|
6
6
|
describe "<%= action %>" do
|
7
|
-
let(:mail) { <%=
|
7
|
+
let(:mail) { <%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %> }
|
8
8
|
|
9
9
|
it "renders the headers" do
|
10
10
|
expect(mail.subject).to eq(<%= action.to_s.humanize.inspect %>)
|
@@ -5,7 +5,7 @@ class <%= class_name %>Preview < ActionMailer::Preview
|
|
5
5
|
|
6
6
|
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
|
7
7
|
def <%= action %>
|
8
|
-
<%=
|
8
|
+
<%= class_name.sub(/(Mailer)?$/, 'Mailer') %>.<%= action %>
|
9
9
|
end
|
10
10
|
<% end -%>
|
11
11
|
|
@@ -46,11 +46,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
46
46
|
describe "GET #index" do
|
47
47
|
it "returns a success response" do
|
48
48
|
<%= class_name %>.create! valid_attributes
|
49
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
50
|
-
get :index, {}, valid_session
|
51
|
-
<% else -%>
|
52
49
|
get :index, params: {}, session: valid_session
|
53
|
-
<% end -%>
|
54
50
|
expect(response).to be_successful
|
55
51
|
end
|
56
52
|
end
|
@@ -59,22 +55,14 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
59
55
|
describe "GET #show" do
|
60
56
|
it "returns a success response" do
|
61
57
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
62
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
63
|
-
get :show, {id: <%= file_name %>.to_param}, valid_session
|
64
|
-
<% else -%>
|
65
58
|
get :show, params: {id: <%= file_name %>.to_param}, session: valid_session
|
66
|
-
<% end -%>
|
67
59
|
expect(response).to be_successful
|
68
60
|
end
|
69
61
|
end
|
70
62
|
|
71
63
|
describe "GET #new" do
|
72
64
|
it "returns a success response" do
|
73
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
74
|
-
get :new, {}, valid_session
|
75
|
-
<% else -%>
|
76
65
|
get :new, params: {}, session: valid_session
|
77
|
-
<% end -%>
|
78
66
|
expect(response).to be_successful
|
79
67
|
end
|
80
68
|
end
|
@@ -82,11 +70,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
82
70
|
describe "GET #edit" do
|
83
71
|
it "returns a success response" do
|
84
72
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
85
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
86
|
-
get :edit, {id: <%= file_name %>.to_param}, valid_session
|
87
|
-
<% else -%>
|
88
73
|
get :edit, params: {id: <%= file_name %>.to_param}, session: valid_session
|
89
|
-
<% end -%>
|
90
74
|
expect(response).to be_successful
|
91
75
|
end
|
92
76
|
end
|
@@ -95,31 +79,19 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
95
79
|
context "with valid params" do
|
96
80
|
it "creates a new <%= class_name %>" do
|
97
81
|
expect {
|
98
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
99
|
-
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
|
100
|
-
<% else -%>
|
101
82
|
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
|
102
|
-
<% end -%>
|
103
83
|
}.to change(<%= class_name %>, :count).by(1)
|
104
84
|
end
|
105
85
|
|
106
86
|
it "redirects to the created <%= ns_file_name %>" do
|
107
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
108
|
-
post :create, {<%= ns_file_name %>: valid_attributes}, valid_session
|
109
|
-
<% else -%>
|
110
87
|
post :create, params: {<%= ns_file_name %>: valid_attributes}, session: valid_session
|
111
|
-
<% end -%>
|
112
88
|
expect(response).to redirect_to(<%= class_name %>.last)
|
113
89
|
end
|
114
90
|
end
|
115
91
|
|
116
92
|
context "with invalid params" do
|
117
93
|
it "returns a success response (i.e. to display the 'new' template)" do
|
118
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
119
|
-
post :create, {<%= ns_file_name %>: invalid_attributes}, valid_session
|
120
|
-
<% else -%>
|
121
94
|
post :create, params: {<%= ns_file_name %>: invalid_attributes}, session: valid_session
|
122
|
-
<% end -%>
|
123
95
|
expect(response).to be_successful
|
124
96
|
end
|
125
97
|
end
|
@@ -133,22 +105,14 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
133
105
|
|
134
106
|
it "updates the requested <%= ns_file_name %>" do
|
135
107
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
136
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
137
|
-
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, valid_session
|
138
|
-
<% else -%>
|
139
108
|
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: new_attributes}, session: valid_session
|
140
|
-
<% end -%>
|
141
109
|
<%= file_name %>.reload
|
142
110
|
skip("Add assertions for updated state")
|
143
111
|
end
|
144
112
|
|
145
113
|
it "redirects to the <%= ns_file_name %>" do
|
146
114
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
147
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
148
|
-
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, valid_session
|
149
|
-
<% else -%>
|
150
115
|
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: valid_attributes}, session: valid_session
|
151
|
-
<% end -%>
|
152
116
|
expect(response).to redirect_to(<%= file_name %>)
|
153
117
|
end
|
154
118
|
end
|
@@ -156,11 +120,7 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
156
120
|
context "with invalid params" do
|
157
121
|
it "returns a success response (i.e. to display the 'edit' template)" do
|
158
122
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
159
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
160
|
-
put :update, {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, valid_session
|
161
|
-
<% else -%>
|
162
123
|
put :update, params: {id: <%= file_name %>.to_param, <%= ns_file_name %>: invalid_attributes}, session: valid_session
|
163
|
-
<% end -%>
|
164
124
|
expect(response).to be_successful
|
165
125
|
end
|
166
126
|
end
|
@@ -170,21 +130,13 @@ RSpec.describe <%= controller_class_name %>Controller, <%= type_metatag(:control
|
|
170
130
|
it "destroys the requested <%= ns_file_name %>" do
|
171
131
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
172
132
|
expect {
|
173
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
174
|
-
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
|
175
|
-
<% else -%>
|
176
133
|
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
|
177
|
-
<% end -%>
|
178
134
|
}.to change(<%= class_name %>, :count).by(-1)
|
179
135
|
end
|
180
136
|
|
181
137
|
it "redirects to the <%= table_name %> list" do
|
182
138
|
<%= file_name %> = <%= class_name %>.create! valid_attributes
|
183
|
-
<% if Rails::VERSION::STRING < '5.0' -%>
|
184
|
-
delete :destroy, {id: <%= file_name %>.to_param}, valid_session
|
185
|
-
<% else -%>
|
186
139
|
delete :destroy, params: {id: <%= file_name %>.to_param}, session: valid_session
|
187
|
-
<% end -%>
|
188
140
|
expect(response).to redirect_to(<%= index_helper %>_url)
|
189
141
|
end
|
190
142
|
end
|
@@ -16,11 +16,7 @@ RSpec.describe "<%= ns_table_name %>/edit", <%= type_metatag(:view) %> do
|
|
16
16
|
assert_select "form[action=?][method=?]", <%= ns_file_name %>_path(@<%= ns_file_name %>), "post" do
|
17
17
|
<% for attribute in output_attributes -%>
|
18
18
|
<%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
|
19
|
-
<% if Rails.version.to_f >= 5.1 -%>
|
20
19
|
assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
21
|
-
<% else -%>
|
22
|
-
assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
23
|
-
<% end -%>
|
24
20
|
<% end -%>
|
25
21
|
end
|
26
22
|
end
|
@@ -15,11 +15,7 @@ RSpec.describe "<%= ns_table_name %>/new", <%= type_metatag(:view) %> do
|
|
15
15
|
assert_select "form[action=?][method=?]", <%= index_helper %>_path, "post" do
|
16
16
|
<% for attribute in output_attributes -%>
|
17
17
|
<%- name = attribute.respond_to?(:column_name) ? attribute.column_name : attribute.name %>
|
18
|
-
<% if Rails.version.to_f >= 5.1 -%>
|
19
18
|
assert_select "<%= attribute.input_type -%>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
20
|
-
<% else -%>
|
21
|
-
assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= name %>[name=?]", "<%= ns_file_name %>[<%= name %>]"
|
22
|
-
<% end -%>
|
23
19
|
<% end -%>
|
24
20
|
end
|
25
21
|
end
|
@@ -1,25 +1,23 @@
|
|
1
1
|
require 'generators/rspec'
|
2
2
|
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
class_option :system_specs, type: :boolean, default: true, desc: "Generate system specs"
|
3
|
+
module Rspec
|
4
|
+
module Generators
|
5
|
+
# @private
|
6
|
+
class SystemGenerator < Base
|
7
|
+
class_option :system_specs, type: :boolean, default: true, desc: "Generate system specs"
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
def generate_system_spec
|
10
|
+
return unless options[:system_specs]
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
template template_name, File.join('spec/system', class_path, filename)
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def template_name
|
16
|
+
'system_spec.rb'
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
19
|
+
def filename
|
20
|
+
"#{table_name}_spec.rb"
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
data/lib/rspec-rails.rb
CHANGED
@@ -7,13 +7,11 @@ module RSpec
|
|
7
7
|
# Railtie to hook into Rails.
|
8
8
|
class Railtie < ::Rails::Railtie
|
9
9
|
# As of Rails 5.1.0 you can register directories to work with `rake notes`
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
SourceAnnotationExtractor::Annotation.register_directories("spec")
|
16
|
-
end
|
10
|
+
require 'rails/source_annotation_extractor'
|
11
|
+
if ::Rails::VERSION::STRING >= '6.0'
|
12
|
+
::Rails::SourceAnnotationExtractor::Annotation.register_directories("spec")
|
13
|
+
else
|
14
|
+
SourceAnnotationExtractor::Annotation.register_directories("spec")
|
17
15
|
end
|
18
16
|
generators = config.app_generators
|
19
17
|
generators.integration_tool :rspec
|
@@ -80,10 +80,8 @@ module RSpec
|
|
80
80
|
# `RSpec::Rails::FixtureSupport` directly instead
|
81
81
|
config.include RSpec::Rails::FixtureSupport
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
config.include RSpec::Rails::FileFixtureSupport
|
86
|
-
end
|
83
|
+
config.add_setting :file_fixture_path, default: 'spec/fixtures/files'
|
84
|
+
config.include RSpec::Rails::FileFixtureSupport
|
87
85
|
|
88
86
|
# Add support for fixture_path on fixture_file_upload
|
89
87
|
config.include RSpec::Rails::FixtureFileUploadSupport
|
@@ -10,10 +10,7 @@ module RSpec
|
|
10
10
|
include RSpec::Rails::Matchers::RedirectTo
|
11
11
|
include RSpec::Rails::Matchers::RenderTemplate
|
12
12
|
include ActionController::TemplateAssertions
|
13
|
-
|
14
|
-
if ActionPack::VERSION::MAJOR >= 5
|
15
|
-
include ActionDispatch::IntegrationTest::Behavior
|
16
|
-
end
|
13
|
+
include ActionDispatch::IntegrationTest::Behavior
|
17
14
|
|
18
15
|
# Delegates to `Rails.application`.
|
19
16
|
def app
|
@@ -41,7 +41,7 @@ module RSpec
|
|
41
41
|
@method_name ||= [
|
42
42
|
self.class.name.underscore,
|
43
43
|
RSpec.current_example.description.underscore
|
44
|
-
].join("_").tr(CHARS_TO_TRANSLATE.join, "_")
|
44
|
+
].join("_").tr(CHARS_TO_TRANSLATE.join, "_").byteslice(0...200).scrub("") + "_#{rand(1000)}"
|
45
45
|
end
|
46
46
|
|
47
47
|
# Delegates to `Rails.application`.
|
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
require 'active_support/testing/file_fixtures'
|
1
|
+
require 'active_support/testing/file_fixtures'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module RSpec
|
4
|
+
module Rails
|
5
|
+
# @private
|
6
|
+
module FileFixtureSupport
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
include ActiveSupport::Testing::FileFixtures
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
10
|
+
included do
|
11
|
+
self.file_fixture_path = RSpec.configuration.file_fixture_path
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -6,21 +6,42 @@ module RSpec
|
|
6
6
|
|
7
7
|
private
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
# In Rails 6.2 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 6.2 expect to rework this to remove
|
11
|
+
# the old accessor.
|
12
|
+
if ::Rails.version.to_f >= 6.1
|
13
|
+
def rails_fixture_file_wrapper
|
14
|
+
RailsFixtureFileWrapper.file_fixture_path = nil
|
15
|
+
resolved_fixture_path =
|
16
|
+
if respond_to?(:file_fixture_path) && !file_fixture_path.nil?
|
17
|
+
file_fixture_path.to_s
|
18
|
+
else
|
19
|
+
(RSpec.configuration.fixture_path || '').to_s
|
20
|
+
end
|
21
|
+
RailsFixtureFileWrapper.file_fixture_path = File.join(resolved_fixture_path, '') unless resolved_fixture_path.strip.empty?
|
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
|
19
36
|
end
|
20
37
|
|
21
38
|
class RailsFixtureFileWrapper
|
22
39
|
include ActionDispatch::TestProcess if defined?(ActionDispatch::TestProcess)
|
23
40
|
|
41
|
+
if ::Rails.version.to_f >= 6.1
|
42
|
+
include ActiveSupport::Testing::FileFixtures
|
43
|
+
end
|
44
|
+
|
24
45
|
class << self
|
25
46
|
attr_accessor :fixture_path
|
26
47
|
|
@@ -13,7 +13,8 @@ module RSpec
|
|
13
13
|
# Monkey patched to avoid collisions with 'let(:name)' in Rails 6.1 and after
|
14
14
|
# and let(:method_name) before Rails 6.1.
|
15
15
|
def run_in_transaction?
|
16
|
-
|
16
|
+
current_example_name = (RSpec.current_example && RSpec.current_example.metadata[:description])
|
17
|
+
use_transactional_tests && !self.class.uses_transaction?(current_example_name)
|
17
18
|
end
|
18
19
|
|
19
20
|
included do
|
@@ -21,11 +22,7 @@ module RSpec
|
|
21
22
|
include Fixtures
|
22
23
|
|
23
24
|
self.fixture_path = RSpec.configuration.fixture_path
|
24
|
-
|
25
|
-
self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
|
26
|
-
else
|
27
|
-
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
|
28
|
-
end
|
25
|
+
self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
|
29
26
|
self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
|
30
27
|
|
31
28
|
fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
|
@@ -22,11 +22,20 @@ module RSpec
|
|
22
22
|
@inbound_email = create_inbound_email(message)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if defined?(::ApplicationMailbox) && ::ApplicationMailbox.router.respond_to?(:mailbox_for)
|
26
|
+
def matches?(mailbox)
|
27
|
+
@mailbox = mailbox
|
28
|
+
@receiver = ApplicationMailbox.router.mailbox_for(inbound_email)
|
28
29
|
|
29
|
-
|
30
|
+
@receiver == @mailbox
|
31
|
+
end
|
32
|
+
else
|
33
|
+
def matches?(mailbox)
|
34
|
+
@mailbox = mailbox
|
35
|
+
@receiver = ApplicationMailbox.router.send(:match_to_mailbox, inbound_email)
|
36
|
+
|
37
|
+
@receiver == @mailbox
|
38
|
+
end
|
30
39
|
end
|
31
40
|
|
32
41
|
def failure_message
|
@@ -41,7 +50,7 @@ module RSpec
|
|
41
50
|
"expected #{describe_inbound_email} not to route to #{mailbox}"
|
42
51
|
end
|
43
52
|
|
44
|
-
|
53
|
+
private
|
45
54
|
|
46
55
|
attr_reader :inbound_email, :mailbox, :receiver
|
47
56
|
|
data/lib/rspec/rails/version.rb
CHANGED
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: 5.0.2
|
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: 2021-
|
47
|
+
date: 2021-08-14 00:00:00.000000000 Z
|
48
48
|
dependencies:
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: actionpack
|
@@ -52,42 +52,42 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '5.2'
|
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: '5.2'
|
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: '5.2'
|
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: '5.2'
|
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: '5.2'
|
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: '5.2'
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec-core
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,7 +296,7 @@ licenses:
|
|
296
296
|
- MIT
|
297
297
|
metadata:
|
298
298
|
bug_tracker_uri: https://github.com/rspec/rspec-rails/issues
|
299
|
-
changelog_uri: https://github.com/rspec/rspec-rails/blob/
|
299
|
+
changelog_uri: https://github.com/rspec/rspec-rails/blob/v5.0.2/Changelog.md
|
300
300
|
documentation_uri: https://rspec.info/documentation/
|
301
301
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
302
302
|
source_code_uri: https://github.com/rspec/rspec-rails
|
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
316
|
- !ruby/object:Gem::Version
|
317
317
|
version: '0'
|
318
318
|
requirements: []
|
319
|
-
rubygems_version: 3.2.
|
319
|
+
rubygems_version: 3.2.22
|
320
320
|
signing_key:
|
321
321
|
specification_version: 4
|
322
322
|
summary: RSpec for Rails
|
metadata.gz.sig
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
��
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
٭���٩�9\o��K"
|
2
|
+
�K��@E�<��K�I�a5����ھ�lܱ(5H�KN�Y�����w .O�U�Vś�~�\p7-/+�Y�X5M��� 3�SP�d�MI��&I�NPNԷ�I�1X�v�:)Kv8�f�!|�'Z`2�]Sc?:v#�����H#���B��T[�6�_���l?�Y^~|j��s��y��!e9���}��� j��4Il`t�)�'�Zc�������є����f�����Ot����O;]0�~
|
3
|
+
��_�>G"
|
4
|
+
m��5upE!G$Pe\������Z�2�wGh�����f�,(6�Tnx���9e��Y�U����K��ϩ�Vew�����}
|