Sha256: 5b0eef3c3e9cf4eccf028fe4180b15cac4209187e6c55323de8ae563dbf3661c
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
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 it "should be able to execute rake command in specific directory" do dir="#{DEV[:dev_root]}/tmp/rake_test" FileUtils.mkdir_p(dir) if(!File.exists?(dir)) File.open("#{dir}/rakefile.rb","w") { |f| f.puts "task :default do" f.puts " puts 'rake_test'" f.puts "end" } cmd=Command.new("rake") cmd[:directory]=dir cmd.execute expect(cmd[:output].include?('rake_test')).to eq(true) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dev_tasks-1.0.9 | spec/command_spec.rb |
dev_tasks-1.0.8 | spec/command_spec.rb |