Permalink
Browse files

[Ruby] Add tests.

  • Loading branch information...
1 parent c704d56 commit e67024bddff8579096323ca0ad5aa328e6a4ec74 @alloy alloy committed Jul 30, 2012
View
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
@@ -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!
@@ -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
@@ -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
@@ -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>

0 comments on commit e67024b

Please sign in to comment.