Sha256: 30ad4e16ddfa8982c615be6ee6034f4fd5620aa880cf505e84f39f42e6f32a85
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'rib/test' require 'rib/more/squeeze_history' describe Rib::SqueezeHistory do behaves_like :rib before do Rib::HistoryFile.enable Rib::SqueezeHistory.enable @history = "/tmp/test_rib_#{rand}" @shell = Rib::Shell.new(:history_file => @history).before_loop @input = %w[foo bar bar foo bar] end after do FileUtils.rm_f(@history) end should 'after_loop saves squeezed history' do @shell.history.push(*@input) @shell.after_loop File.read(@history).should.eq %w[foo bar foo bar].join("\n") + "\n" end should 'loop_once squeeze history' do times = @input.size stub(@shell).get_input{ (@shell.history << "'#{@input.shift}'")[-1] } stub(@shell).print_result(anything) times.times{ @shell.loop_once } @shell.history.to_a.should.eq %w[foo bar foo bar].map{ |i| "'#{i}'" } end should 'be disabled if disabled' do Rib::SqueezeHistory.disable times = @input.size input = @input.dup stub(@shell).get_input{ (@shell.history << "'#{@input.shift}'")[-1] } stub(@shell).print_result(anything) times.times{ @shell.loop_once } @shell.history.to_a.should.eq input.map{ |i| "'#{i}'" } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rib-0.1.0 | test/more/test_squeeze_history.rb |