2019-03-28 10:22:29 -04:00
|
|
|
require_relative '../../spec_helper'
|
|
|
|
|
2020-02-08 05:43:27 -05:00
|
|
|
describe "Binding#irb" do
|
|
|
|
it "creates an IRB session with the binding in scope" do
|
|
|
|
irb_fixture = fixture __FILE__, "irb.rb"
|
|
|
|
irbrc_fixture = fixture __FILE__, "irbrc"
|
2019-03-28 10:22:29 -04:00
|
|
|
|
2020-02-08 05:43:27 -05:00
|
|
|
out = IO.popen([{"IRBRC"=>irbrc_fixture}, *ruby_exe, irb_fixture], "r+") do |pipe|
|
|
|
|
pipe.puts "a ** 2"
|
|
|
|
pipe.puts "exit"
|
|
|
|
pipe.readlines.map(&:chomp)
|
2019-03-28 10:22:29 -04:00
|
|
|
end
|
2020-02-08 05:43:27 -05:00
|
|
|
|
|
|
|
out[-3..-1].should == ["a ** 2", "100", "exit"]
|
2019-03-28 10:22:29 -04:00
|
|
|
end
|
|
|
|
end
|