@@ -169,61 +169,3 @@ Feature: `have_reported_error` matcher
169
169
"""
170
170
When I run `rspec spec/models/user_spec.rb`
171
171
Then the examples should all pass
172
-
173
- Scenario : Using in controller specs
174
- Given a file named "spec/controllers/users_controller_spec.rb" with:
175
- """ruby
176
- require "rails_helper"
177
-
178
- RSpec.describe UsersController, type: :controller do
179
- describe "POST #create" do
180
- it "reports validation errors" do
181
- expect {
182
- post :create, params: { user: { email: "invalid" } }
183
- }.to have_reported_error(ValidationError)
184
- end
185
- end
186
- end
187
- """
188
- When I run `rspec spec/controllers/users_controller_spec.rb`
189
- Then the examples should all pass
190
-
191
- Scenario : Using in request specs
192
- Given a file named "spec/requests/users_spec.rb" with:
193
- """ruby
194
- require "rails_helper"
195
-
196
- RSpec.describe "Users", type: :request do
197
- describe "POST /users" do
198
- it "reports processing errors" do
199
- expect {
200
- post "/users", params: { user: { name: "Test" } }
201
- }.to have_reported_error.with(context: "user_creation")
202
- end
203
- end
204
- end
205
- """
206
- When I run `rspec spec/requests/users_spec.rb`
207
- Then the examples should all pass
208
-
209
- Scenario : Complex error matching with multiple conditions
210
- Given a file named "spec/models/user_spec.rb" with:
211
- """ruby
212
- require "rails_helper"
213
-
214
- RSpec.describe User do
215
- it "reports error with class, message pattern, and attributes" do
216
- expect {
217
- Rails.error.report(
218
- ArgumentError.new("Invalid user data provided"),
219
- context: "validation",
220
- severity: "critical",
221
- user_id: 123
222
- )
223
- }.to have_reported_error(ArgumentError)
224
- .with(context: "validation", severity: "critical")
225
- end
226
- end
227
- """
228
- When I run `rspec spec/models/user_spec.rb`
229
- Then the examples should all pass
0 commit comments