spec/shelltastic_spec.rb in shelltastic-0.5.0 vs spec/shelltastic_spec.rb in shelltastic-1.0.0
- old
+ new
@@ -1,65 +1,64 @@
require 'spec_helper'
describe ShellTastic do
- it "should run a shell command" do
+ it "runs a shell command"do
result = ShellTastic::Command.run("ls -l").first
- result.fetch(:exitstatus).should eq(0)
+ expect(result.fetch(:exitstatus)).to eq(0)
end
- it "should run multiple commands" do
+ it "runs multiple commands"do
result = ShellTastic::Command.run("ls -l", "date")
- result.size.should eq(2)
+ expect(result.size).to eq(2)
end
- it "should run take an array of commands to run" do
+ it "takes an array of commands to run"do
result = ShellTastic::Command.run(["ls -l", "date"])
- result.size.should eq(2)
+ expect(result.size).to eq(2)
end
- it "should raise a command exception" do
+ it "raises a command exception"do
expect {
- result = ShellTastic::Command.run("lss -l")
+ result = ShellTastic::Command.run("lss -l")
}.to raise_error(ShellTastic::CommandException)
end
- it "should alert if command is empty or nil" do
+ it "alerts if command is empty or nil"do
expect {
ShellTastic::Command.run("")
}.to raise_error(ShellTastic::CommandException)
end
- it "should return `false` for error if there is not any errors" do
+ it "returns `false` for error if there is not any errors"do
result = ShellTastic::Command.run("date").first
- result[:error].should eq(false)
+ expect(result[:error]).to eq(false)
end
- it "should return error" do
- result = ShellTastic::Command.run("du -sh /tmp/foos").first
- result[:error].should_not eq(false)
+ it "returns an error and exit status"do
+ result = ShellTastic::Command.run("du -sh /tmp/inotexist").first
+ expect(result[:error]).not_to be_nil
+ expect(result[:exitstatus]).to eq(1)
end
# fire and forget
- it "should fire a command in the background and have a pid" do
+ it "fires a command in the background and has a pid"do
result = ShellTastic::Command.start("ls -al /").first
- result[:pid].should_not be_nil
+ expect(result[:pid]).not_to be_nil
end
- it "should fire a command in the background and have a command" do
+ it "fires a command in the background and has a command populated"do
result = ShellTastic::Command.start("ls -al /").first
- result[:command].should eq("ls -al /")
+ expect(result[:command]).to eq("ls -al /")
end
- it "should fire a command in the background and have no ouput" do
+ it "fires a command in the background and has no ouput"do
result = ShellTastic::Command.start("ls -al /").first
- result[:output].should be_nil
+ expect(result[:output]).to be_nil
end
- it "should fire a command in the background and not raise an error" do
+ it "fires a command in the background and raises an error"do
expect {
ShellTastic::Command.start("foobar").first
}.to raise_error(ShellTastic::CommandException)
end
-
-
end