require 'rspec' require 'pp' require 'systemu' # To run this test: # $ rspec /path/to/test_script_being_tested.rb # Assumes that the name of the file being tested is ../something.rb relative to the directory containing this test scripts, and the name of this tes script is test_something.rb $:.unshift File.join(File.dirname(__FILE__),'..') script_under_test = File.basename(__FILE__).gsub(/_spec.rb$/,'.rb') path_to_script = File.join(File.dirname(__FILE__),'..','bin',script_under_test) describe script_under_test do it 'should scripting test ok' do inputs = < inputs raise stderr if stderr != '' stderr.should eq("") status.exitstatus.should eq(0), "testing #{path_to_script}" expected = (1..632).collect{|s| "#{s}\t"}.join("\n")+ "\n633\t1\n" stdout.should eq(expected) end end