summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/pry_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/pry_spec.rb b/spec/pry_spec.rb
index 1ea0210d..f5bb0713 100644
--- a/spec/pry_spec.rb
+++ b/spec/pry_spec.rb
@@ -184,6 +184,31 @@ describe Pry do
.to raise_error SignalException
end
+ describe "inside signal handler" do
+ before do
+ if Pry::Helpers::Platform.jruby?
+ skip "jruby allows mutex usage in signal handlers"
+ end
+
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.0.0")
+ skip "pre-2.0 mri allows mutex usage in signal handlers"
+ end
+
+ trap("USR1") { @str_output = mock_pry }
+ end
+
+ after do
+ trap("USR1") do
+ # do nothing
+ end
+ end
+
+ it "should return with error message" do
+ Process.kill("USR1", Process.pid)
+ expect(@str_output).to match(/Unable to obtain mutex lock/)
+ end
+ end
+
describe "multi-line input" do
it "works" do
expect(mock_pry('x = ', '1 + 4')).to match(/5/)