lib/rib/test/multiline.rb in rib-1.5.1 vs lib/rib/test/multiline.rb in rib-1.5.2

- old
+ new

@@ -1,55 +1,47 @@ copy :setup_multiline do - def setup_shell - @shell = new_shell - stub(@shell).print{}.with_any_args - stub(@shell).puts{} .with_any_args - end - def setup_input str if readline? - mock(::Readline).readline(is_a(String), true){ - (::Readline::HISTORY << str.chomp)[-1] - } + stub_readline(:mock) else mock($stdin).gets{ str.chomp } end end def input str setup_input(str) - mock(@shell).throw(:rib_multiline) + mock(shell).throw(:rib_multiline) end def input_done str, err=nil setup_input(str) if err - mock(@shell).print_eval_error(is_a(err)){} + mock(shell).print_eval_error(is_a(err)){} else - mock(@shell).print_result(is_a(Object)){} + mock(shell).print_result(is_a(Object)){} end - @shell.loop_once + shell.loop_once ok end def check str, err=nil lines = str.split("\n") lines[0...-1].each{ |line| input(line) - @shell.loop_once + shell.loop_once } input_done(lines.last, err) end end copy :multiline do before do - setup_shell + stub_output end would 'work with no prompt' do - @shell.config[:prompt] = '' + shell.config[:prompt] = '' check <<-RUBY def f 0 end RUBY