diff options
Diffstat (limited to 'spec/ruby/core/binding/irb_spec.rb')
-rw-r--r-- | spec/ruby/core/binding/irb_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/core/binding/irb_spec.rb b/spec/ruby/core/binding/irb_spec.rb new file mode 100644 index 0000000000..dd3df0b28a --- /dev/null +++ b/spec/ruby/core/binding/irb_spec.rb @@ -0,0 +1,17 @@ +require_relative '../../spec_helper' + +ruby_version_is "2.5" do + describe "Binding#irb" do + it "creates an IRB session with the binding in scope" do + irb_fixture = fixture __FILE__, "irb.rb" + + out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe| + pipe.puts "a ** 2" + pipe.puts "exit" + pipe.readlines.map(&:chomp) + end + + out[-3..-1].should == ["a ** 2", "100", "exit"] + end + end +end |