Permalink
Browse files

Fix IO.popen call on Ruby 1.9.x. Fixes #15.

  • Loading branch information...
1 parent c4a4d0a commit d348df5f7cada6c744b18793de1622315c036277 @alloy alloy committed Aug 10, 2012
Showing with 7 additions and 3 deletions.
  1. +1 −1 Ruby/Gemfile.lock
  2. +1 −1 Ruby/lib/terminal-notifier.rb
  3. +5 −1 Ruby/spec/terminal-notifier_spec.rb
View
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- terminal-notifier (1.3.0)
+ terminal-notifier (1.4.1)
GEM
remote: http://rubygems.org/
@@ -17,7 +17,7 @@ def self.execute(verbose, options)
command = Shellwords.shelljoin(command)
end
result = ''
- IO.popen(*command) do |stdout|
+ IO.popen(command) do |stdout|
output = stdout.read
STDOUT.print output if verbose
result << output
@@ -15,10 +15,14 @@
require 'shellwords'
command = Shellwords.shelljoin(command)
end
- IO.expects(:popen).with(*command).yields(StringIO.new('output'))
+ IO.expects(:popen).with(command).yields(StringIO.new('output'))
TerminalNotifier.execute(false, :message => 'ZOMG')
end
+ it "returns the result output of the command" do
+ TerminalNotifier.execute(false, 'help' => '').should == `'#{TerminalNotifier::BIN_PATH}' -help`
+ end
+
it "sends a notification" do
TerminalNotifier.expects(:execute).with(false, :message => 'ZOMG', :group => 'important stuff')
TerminalNotifier.notify('ZOMG', :group => 'important stuff')

0 comments on commit d348df5

Please sign in to comment.