1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/spec/integration/hanami_spec.rb
Kyrylo Silin e61354693f Add .rspec and require 'helper' from there
Just discovered this nice feature of RSpec where it can load all files for
us. Works with `bundle exec rake` and `bundle exec rspec spec/file_spec.rb`,
which covers all use cases.
2018-11-18 14:04:44 +08:00

37 lines
1,000 B
Ruby

require "shellwords"
RSpec.describe "Hanami integration" do
before :all do
@ruby = RbConfig.ruby.shellescape
@pry_dir = File.expand_path(File.join(__FILE__, '../../../lib')).shellescape
end
it "does not enter an infinite loop (#1471, #1621)" do
skip "prepend is not supported on this version of Ruby" if RUBY_VERSION.start_with? "1.9"
code = <<-RUBY
require "pry"
require "timeout"
module Prepend1
def call(arg)
super
end
end
module Prepend2
def call(arg)
super
end
end
class Action
prepend Prepend1
prepend Prepend2
def call(arg)
binding.pry input: StringIO.new("exit"), output: StringIO.new
end
end
Timeout.timeout(1) { Action.new.call("define prison, in the abstract sense") }
exit 42
RUBY
`#@ruby -I#@pry_dir -e'#{code}'`
expect($?.exitstatus).to eq(42)
end
end