Permalink
Browse files

ruby-growl => ruby_gntp

  • Loading branch information...
jugyo committed Nov 14, 2011
1 parent 2b5e8af commit f71748cf7699e3fd5c826fb689b98cdeeec5c409
Showing with 15 additions and 18 deletions.
  1. +7 −6 Rakefile
  2. +4 −3 lib/g.rb
  3. +4 −9 spec/g_spec.rb
View
@@ -11,15 +11,16 @@ begin
gem.homepage = "http://github.com/jugyo/g"
gem.authors = ["jugyo"]
gem.add_development_dependency "rspec", ">= 0"
- gem.add_dependency "ruby-growl", ">= 1.0.1"
+ gem.add_dependency "ruby_gntp", ">= 1.0.1"
end
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
-require 'spec/rake/spectask'
-desc 'run all specs'
-Spec::Rake::SpecTask.new do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = ['-c']
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
end
+
+task :default => :spec
View
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'ruby-growl'
+require 'ruby_gntp'
require 'pp'
$g_host ||= "localhost"
@@ -8,7 +8,7 @@
module Kernel
def g(*args, &block)
- growl = Growl.new $g_host, 'g', [$0]
+ # growl = Growl.new $g_host, 'g', [$0]
args.push(block) if block
@@ -19,7 +19,8 @@ def g(*args, &block)
args.map { |i| i.pretty_inspect }
end
- messages.each { |i| growl.notify $0, 'g', i, $g_priority, $g_sticky }
+ # messages.each { |i| growl.notify $0, 'g', i, $g_priority, $g_sticky }
+ messages.each { |i| GNTP.notify :app_name => $0, :title => 'g', :text => i, :sticky => $g_sticky }
if args.empty?
nil
View
@@ -2,30 +2,25 @@
require 'g'
describe 'g' do
- before do
- @g = Object.new
- Growl.should_receive(:new).and_return(@g)
- end
-
it 'calls with a arg' do
- @g.should_receive(:notify).with($0, "g", 'foo'.pretty_inspect, 0, true)
+ GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "foo".pretty_inspect, :sticky=>true)
g('foo').should == 'foo'
end
it 'calls with block' do
block = Proc.new {}
- @g.should_receive(:notify).with($0, "g", block.pretty_inspect, 0, true)
+ GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => block.pretty_inspect, :sticky=>true)
g(&block).should == block
end
it 'calls with args' do
block = Proc.new {}
- @g.should_receive(:notify).exactly(3).times
+ GNTP.should_receive(:notify).exactly(3).times
g('foo', 1, &block).should == ['foo', 1, block]
end
it 'calls without args' do
- @g.should_receive(:notify).with($0, "g", "g!", 0, true)
+ GNTP.should_receive(:notify).with(:app_name => $0, :title => "g", :text => "g!", :sticky=>true)
g.should == nil
end
end

0 comments on commit f71748c

Please sign in to comment.