spec/shelltastic_spec.rb in shelltastic-0.3.0 vs spec/shelltastic_spec.rb in shelltastic-0.4.0

- old
+ new

@@ -1,11 +1,11 @@ require 'spec_helper' describe ShellTastic do it "should run a shell command" do - result = ShellTastic::Command.run("ls -l") - result.first.fetch(:exitstatus).should eq(0) + result = ShellTastic::Command.run("ls -l").first + result.fetch(:exitstatus).should eq(0) end it "should run multiple commands" do result = ShellTastic::Command.run("ls -l", "date") result.size.should eq(2) @@ -24,9 +24,20 @@ end it "should alert if command is empty or nil" do expect { ShellTastic::Command.run("") - }.to raise_error("The command is emtpy or nil") + }.to raise_error(ShellTastic::CommandException) end + + it "should return `false` for error if there is not any errors" do + result = ShellTastic::Command.run("date").first + result[:error].should eq(false) + end + + it "should return error" do + result = ShellTastic::Command.run("du -sh /tmp/foos").first + result[:error].should_not eq(false) + end + end