Sha256: dc5e3b2dded4efdf5fa39b7874c740428cd1d37451beaf2fc3e7ceb477e54491
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require 'spec_helper' describe "commands" do it "should build simple command" do brash = Brash.build { rm.dash("rf", "/tmp/nothing") } brash.to_bash.should == "rm -rf /tmp/nothing" end it "should build simple command without dash" do brash = Brash.build { cd("/tmp/somewhere") } brash.to_bash.should == "cd /tmp/somewhere" end it "should build compound command" do brash = Brash.build { xargs.echo } brash.to_bash.should == "xargs echo" end it "should allow additional args" do brash = Brash.build { email.dash("u", "jlane@engineyard.com").arg("ohhai") } brash.to_bash.should == 'email -u jlane@engineyard.com ohhai' end it "should escape additional args with a space" do brash = Brash.build { email.dash("u", "jlane@engineyard.com").arg("oh hai") } brash.to_bash.should == 'email -u jlane@engineyard.com "oh hai"' end it "should escape dash arguments with a space" do brash = Brash.build { email.dash("m", "lol ulol") } brash.to_bash.should == 'email -m "lol ulol"' end it "should build simple command with pipe" do brash = Brash.build { cat("/tmp/kitty").pipe_to { xargs } } brash.to_bash.should == "cat /tmp/kitty | xargs" end it "should build compound command with pipe" do brash = Brash.build { cat("/tmp/kitty").pipe_to { xargs.echo } } brash.to_bash.should == "cat /tmp/kitty | xargs echo" end it "should escape compound command string arguments" do brash = Brash.build do ssh.dash("c", Proc.new { pwd }) end brash.to_bash.should == 'ssh -c "pwd"' end it "should escape compound command string arguments more than once" do brash = Brash.build do ssh.dash("c", Proc.new { ssh.dash("c", Proc.new { pwd }) }) end brash.to_bash.should == 'ssh -c "ssh -c \"pwd\""' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
brash-0.0.1 | spec/command_spec.rb |