summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorKyrylo Silin <silin@kyrylo.org>2019-05-04 20:18:45 +0300
committerKyrylo Silin <silin@kyrylo.org>2019-05-04 20:19:51 +0300
commit224b575fc7f19b89c64b06b69054bfbbe2f7c800 (patch)
treee65d68f06826323b35a08c62d7f9d1f3c8b094cb /spec
parente1ac530b02776038e24acc7ca91a66652f5060ee (diff)
downloadpry-224b575fc7f19b89c64b06b69054bfbbe2f7c800.tar.gz
warning: print file and line of the calling frame
We want to print the calling frame, so we can point out who exactly triggered it. The current behaviour is less useful (we print the line that called the warning).
Diffstat (limited to 'spec')
-rw-r--r--spec/warning_spec.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/spec/warning_spec.rb b/spec/warning_spec.rb
index 3f7328ce..18bfa219 100644
--- a/spec/warning_spec.rb
+++ b/spec/warning_spec.rb
@@ -1,9 +1,7 @@
RSpec.describe Pry::Warning do
describe "#warn" do
- it "prints a warning with file and line" do
- expect(Kernel).to receive(:warn).with(
- "#{__FILE__}:#{__LINE__ + 2}: warning: foo bar"
- )
+ it "prints message with file and line of the calling frame" do
+ expect(Kernel).to receive(:warn).with(/.+\.rb:\d+: warning: foo bar/)
described_class.warn('foo bar')
end
end