diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-22 16:49:47 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-22 16:49:47 -0400 |
commit | bde3b79691808d802dc78535b8be1b82327f891e (patch) | |
tree | 4acdb177ef4bc6c2e63bbdb5b84129acbeb03274 | |
parent | 7e2f70d98c9cf8144656b76fcb83a143f4fafa3e (diff) | |
download | mixlib-shellout-bde3b79691808d802dc78535b8be1b82327f891e.tar.gz |
[RSPEC] Refactored spec for running command with special characters
-rw-r--r-- | spec/mixlib/shellout/shellout_spec.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb index 3f45554..aa37de7 100644 --- a/spec/mixlib/shellout/shellout_spec.rb +++ b/spec/mixlib/shellout/shellout_spec.rb @@ -331,15 +331,20 @@ describe Mixlib::ShellOut do let(:echotext) { 10000.upto(11340).map(&:to_s).join(' ') } let(:cmd) { "echo #{echotext}" } - it "should execute" do + it 'should execute' do should eql(echotext) end end - it "runs commands with quotes and special characters in quotes" do - cmd = Mixlib::ShellOut.new(%q{ruby -e 'print "<>&|&&||;"'}) - cmd.run_command - cmd.stdout.should == "<>&|&&||;" + context 'with special characters' do + subject { stdout } + + let(:special_characters) { '<>&|&&||;' } + let(:cmd) { "ruby -e 'print \"#{special_characters}\"'" } + + it 'should execute' do + should eql(special_characters) + end end it "runs commands with backslashes in them" do |