Skip to content

Commit

Permalink
[Ruby] Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Jul 30, 2012
1 parent c704d56 commit e67024b
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Ruby/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source :rubygems
gemspec
23 changes: 23 additions & 0 deletions Ruby/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PATH
remote: .
specs:
terminal-notifier (1.3.0)

GEM
remote: http://rubygems.org/
specs:
bacon (1.1.0)
metaclass (0.0.1)
mocha (0.11.4)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.0)
mocha (>= 0.9.8)

PLATFORMS
ruby

DEPENDENCIES
bacon
mocha
mocha-on-bacon
terminal-notifier!
31 changes: 31 additions & 0 deletions Ruby/spec/terminal-notifier_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'rubygems'
require 'bacon'
require 'mocha'
require 'mocha-on-bacon'

Bacon.summary_at_exit

$:.unshift File.expand_path('../../lib', __FILE__)
require 'terminal-notifier'

describe "TerminalNotifier" do
it "converts options to args" do
TerminalNotifier.expects(:execute).with(['-message', 'ZOMG'])
TerminalNotifier.execute_with_options(:message => 'ZOMG')
end

it "executes the tool with the given arguments" do
TerminalNotifier.expects(:system).with(TerminalNotifier::BIN_PATH, '-message', 'ZOMG')
TerminalNotifier.execute(['-message', 'ZOMG'])
end

it "sends a notification" do
TerminalNotifier.expects(:execute_with_options).with(:message => 'ZOMG', :group => 'important stuff')
TerminalNotifier.notify('ZOMG', :group => 'important stuff')
end

it "removes a notification" do
TerminalNotifier.expects(:execute_with_options).with(:remove => 'important stuff')
TerminalNotifier.remove('important stuff')
end
end
7 changes: 6 additions & 1 deletion Ruby/terminal-notifier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ Gem::Specification.new do |gem|
gem.email = ["eloy.de.enige@gmail.com"]
gem.homepage = 'https://github.com/alloy/terminal-notifier'

gem.files = ['lib/terminal-notifier.rb'] + Dir.glob('vendor/terminal-notifier/**/*')
gem.executables = ['terminal-notifier']
gem.files = ['bin/terminal-notifier', 'lib/terminal-notifier.rb'] + Dir.glob('vendor/terminal-notifier/**/*')
gem.require_paths = ['lib']

gem.extra_rdoc_files = ['README.markdown']

gem.add_development_dependency 'bacon'
gem.add_development_dependency 'mocha'
gem.add_development_dependency 'mocha-on-bacon'
end
4 changes: 2 additions & 2 deletions Terminal Notifier/Terminal Notifier-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.0</string>
<string>1.3.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3</string>
<string>4</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSUIElement</key>
Expand Down

0 comments on commit e67024b

Please sign in to comment.