windows notifiaction works (tested with guard-bundler)

This commit is contained in:
slavic 2011-05-22 00:47:02 +03:00
parent 02448b8575
commit 18d2db9ff1
3 changed files with 11 additions and 14 deletions

View File

@ -15,5 +15,5 @@ end
if Config::CONFIG['target_os'] =~ /mswin|mingw/i
gem 'win32console', :require => false
gem 'rb-fchange', '>= 0.0.2', :require => false
gem 'rb-notifu', :require => false
gem 'rb-notifu', '>= 0.0.3', :require => false
end

View File

@ -33,7 +33,7 @@ module Guard
Libnotify.show :body => message, :summary => title, :icon_path => image_path(image)
when /mswin|mingw/i
require_rbnotifu
RbNotifu.show :message => message, :title => title, :type => image_level(image)
RbNotifu.show :message => message, :title => title, :type => image_level(image), :display => 3000
end
end
end
@ -87,10 +87,10 @@ module Guard
end
def self.require_rbnotifu
require 'rbnotifu'
require 'rb-notifu'
rescue LoadError
turn_off
UI.info "Please install rbnotifu gem for Windows notification support and add it to your Gemfile"
UI.info "Please install rb-notifu gem for Windows notification support and add it to your Gemfile"
end
end
end

View File

@ -39,12 +39,13 @@ describe Guard::Notifier do
if windows?
if rbnotifu_installed?
it "uses rbnotifu on Windows" do
RbNotifu::show(
:message => "great",
:title => 'Guard',
:type => :info
)
it "uses rb-notifu on Windows" do
@result = -1
RbNotifu::show :message => "great", :title => 'Guard' do |status|
@result = status
end
sleep 1.5
RbNotifu::ERRORS.include?(@result).should be_false
end
else
it { should_not be_enabled }
@ -64,10 +65,6 @@ describe Guard::Notifier do
Libnotify.should_not_receive(:show)
subject.notify 'great', :title => 'Guard'
end
elsif windows? && rbnotifu_installed?
it "prevents the notifications" do
end
end
it { should_not be_enabled }