Skip to content

Commit b5568a0

Browse files
author
Stanislav (Stas) Katkov
committed
remove context attribute in specs
1 parent 90ff6af commit b5568a0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spec/rspec/rails/matchers/have_reported_error_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class AnotherTestError < StandardError; end
9393
it "provides details about mismatched attributes" do
9494
expect {
9595
expect {
96-
Rails.error.report(StandardError.new("test"), context: { user_id: 123, context: "actual" })
97-
}.to have_reported_error.with_context(user_id: 456, context: "expected")
96+
Rails.error.report(StandardError.new("test"), context: { user_id: 123, topic: "actual" })
97+
}.to have_reported_error.with_context(user_id: 456, topic: "expected")
9898
}.to fail_with(/Expected error attributes to match/)
9999
end
100100

@@ -117,23 +117,23 @@ class AnotherTestError < StandardError; end
117117
it "shows actual context values when attributes don't match" do
118118
expect {
119119
expect {
120-
Rails.error.report(StandardError.new("test"), context: { user_id: 123, context: "actual" })
120+
Rails.error.report(StandardError.new("test"), context: { user_id: 123, topic: "actual" })
121121
}.to have_reported_error.with_context(user_id: 456)
122-
}.to fail_with(/actual values are.*user_id.*123.*context.*actual/)
122+
}.to fail_with(/actual values are.*user_id.*123.*topic.*actual/)
123123
end
124124
end
125125

126126
describe "#with_context" do
127127
it "passes when attributes match exactly" do
128128
expect {
129-
Rails.error.report(StandardError.new("test"), context: { user_id: 123, context: "test" })
130-
}.to have_reported_error.with_context(user_id: 123, context: "test")
129+
Rails.error.report(StandardError.new("test"), context: { user_id: 123, topic: "test" })
130+
}.to have_reported_error.with_context(user_id: 123, topic: "test")
131131
end
132132

133133
it "passes with partial attribute matching" do
134134
expect {
135135
Rails.error.report(
136-
StandardError.new("test"), context: { user_id: 123, context: "test", extra: "data" }
136+
StandardError.new("test"), context: { user_id: 123, extra: "data" }
137137
)
138138
}.to have_reported_error.with_context(user_id: 123)
139139
end
@@ -149,8 +149,8 @@ class AnotherTestError < StandardError; end
149149
it "fails when attributes do not match" do
150150
expect {
151151
expect {
152-
Rails.error.report(StandardError.new("test"), context: { user_id: 123, context: "actual" })
153-
}.to have_reported_error.with_context(user_id: 456, context: "expected")
152+
Rails.error.report(StandardError.new("test"), context: { user_id: 123, topic: "actual" })
153+
}.to have_reported_error.with_context(user_id: 456, topic: "expected")
154154
}.to fail_with(/Expected error attributes to match/)
155155
end
156156

0 commit comments

Comments
 (0)