Sha256: f55f406a5b63511994c4742968d38dbc9cb2a42d04b2f190831c9d5b7d2a96d9
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require File.join(File.dirname(__FILE__), %w[spec_helper]) describe Shellshot do it "should execute the given command" do Shellshot.exec("touch file") "file".should be_a_file end it "should pipe the out to the right file" do Shellshot.exec(%q[ruby -e 'puts "Hello World"'], :stdout => "file") "file".should contain("Hello World") end it "should pipe the err to the right file" do Shellshot.exec(%q[ruby -e '$stderr << "error"'], :stderr => "file") "file".should contain("error") end it "should pipe everything to the right file" do Shellshot.exec(%q[ruby -e '$stderr << "Hello "; puts "World"'], :stdall => "file") "file".should contain("Hello World") end it "should cancel execution on time if timeout provided" do lambda { Shellshot.exec %q[ruby -e 'sleep 10000'], :timeout => 1 }.should raise_error(Timeout::Error) end it "should raise error if command returned something else." do lambda { Shellshot.exec %q[ruby -e '$stderr << "problem"; exit 1;'] }.should raise_error(Shellshot::CommandError, "problem") end end # EOF
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shellshot-0.3.1 | spec/shellshot_spec.rb |
shellshot-0.3.0 | spec/shellshot_spec.rb |