require_relative '../lib/command.rb' describe Command do it "should be able to execute ruby --version command" do cmd=Command.new("ruby --version") # Timeout expect(cmd[:timeout]).to eq(0) cmd[:timeout]=3000 expect(cmd[:timeout]).to eq(3000) # Directory expect(cmd[:directory]).to eq("") cmd[:directory] = File.dirname(__FILE__) expect(cmd[:directory]).to eq(File.dirname(__FILE__)) # ExitCode expect(cmd[:exit_code]).to eq(0) cmd[:exit_code] = 1 expect(cmd[:exit_code]).to eq(1) # Input expect(cmd[:input]).to eq("ruby --version") cmd2 = Command.new('') expect(cmd2[:input]).to eq('') # Output expect(cmd[:output]).to eq('') cmd[:output]='test' expect(cmd[:output]).to eq('test') # Error expect(cmd[:error]).to eq('') cmd[:error]='error_test' expect(cmd[:error]).to eq('error_test') # MachineName expect(cmd[:machine_name]).to eq('') cmd[:machine_name]='machine_name_test' expect(cmd[:machine_name]).to eq('machine_name_test') # UserName expect(cmd[:user_name]).to eq('') cmd[:user_name]='user_name_test' expect(cmd[:user_name]).to eq('user_name_test') # StartTime expect(cmd[:start_time]).to eq(nil) cmd[:start_time]=Time.now expect(cmd[:start_time]).not_to eq(nil) # EndTime expect(cmd[:end_time]).to eq(nil) cmd[:end_time]=Time.now expect(cmd[:end_time]).not_to eq(nil) end end