Skip to content

Commit

Permalink
Update terminal-notifier_spec.rb
Browse files Browse the repository at this point in the history
Add test case for arguments starting with a dash.
  • Loading branch information
iRath96 authored and julienXX committed Oct 29, 2017
1 parent ff00d6d commit 5c990a1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Ruby/spec/terminal-notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
IO.expects(:popen).with(command).yields(StringIO.new('output'))
TerminalNotifier.execute(false, :message => '[ZOMG] "OH YEAH"')
end

it "correctly escapes arguments that start with a dash" do
command = [TerminalNotifier::BIN_PATH, '-message', ' -kittens', '-title', ' -rule']
command = Shellwords.join(command) if RUBY_VERSION < '1.9'
IO.expects(:popen).with(command).yields(StringIO.new('output'))
TerminalNotifier.execute(false, :message => '-kittens', :title => '-rule')
end

it "returns the result output of the command" do
TerminalNotifier.execute(false, 'help' => '').should == `'#{TerminalNotifier::BIN_PATH}' -help`
Expand Down

0 comments on commit 5c990a1

Please sign in to comment.