Skip to content

Commit 217b51e

Browse files
committed
Add spec for Binding#irb.
1 parent 2a9687b commit 217b51e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a = 10
2+
3+
binding.irb

spec/ruby/core/binding/irb_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require_relative '../../spec_helper'
2+
3+
ruby_version_is "2.5" do
4+
describe "Binding#irb" do
5+
it "creates an IRB session with the binding in scope" do
6+
irb_fixture = fixture __FILE__, "irb.rb"
7+
8+
out = IO.popen([*ruby_exe, irb_fixture], "r+") do |pipe|
9+
pipe.puts "a ** 2"
10+
pipe.puts "exit"
11+
pipe.readlines.map(&:chomp)
12+
end
13+
14+
out[-3..-1].should == ["a ** 2", "100", "exit"]
15+
end
16+
end
17+
end

0 commit comments

Comments
 (0)