guard / guard-cucumber

Guard::Cucumber automatically run your features (much like autotest)
https://rubygems.org/gems/guard-cucumber
MIT License
86 stars 36 forks source link

Sending a symbol as the icon to ruby_gntp causes a crash #27

Open ericgross opened 9 years ago

ericgross commented 9 years ago

I am using ruby_gntp to send notifications and it works for RSpec, but Cucumber is causing

no implicit conversion of Symbol into String (TypeError)
/home/eric/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ruby_gntp-0.3.4/lib/ruby_gntp.rb:271:in `exists?'
/home/eric/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ruby_gntp-0.3.4/lib/ruby_gntp.rb:271:in `handle_icon'
/home/eric/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ruby_gntp-0.3.4/lib/ruby_gntp.rb:214:in `notify_header'
/home/eric/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ruby_gntp-0.3.4/lib/ruby_gntp.rb:111:in `notify'
/home/eric/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/notiffany-0.0.7/lib/notiffany/notifier/gntp.rb:63:in `_perform_notify'
...

In this case, icon is :passed and type is "Notification".

e2 commented 9 years ago

I think this should be reported in the notiffany project, where the symbol should be properly translated into a filename (containing a path to one of notiffany's icons).

Could you report it there? Thanks!

ethagnawl commented 8 years ago

@ericgross Were you able to come up with a workaround for this issue?

e2 commented 8 years ago

I'd like a test case for this, because I don't use ruby_gntp.

Here's the notifier code in Guard::RSpec

https://github.com/guard/guard-rspec/blob/d416da347678db6042a781af504804ad4b92d352/lib/guard/rspec/notifier.rb#L15

It passes :image which is one of: :failed, :pending, :success.

Here's the notifier from Guard::Cucumber

https://github.com/guard/guard-cucumber/blob/bcc8a79386adfe863fec288c7dcf364cadb93914/lib/guard/cucumber/notification_formatter.rb#L121

Which also passes one of those options: https://github.com/guard/guard-cucumber/blob/bcc8a79386adfe863fec288c7dcf364cadb93914/lib/guard/cucumber/notification_formatter.rb#L137

So I have no idea how Guard::RSpec works but Guard::Cucumber doesn't.

Does the simple Notiffany example work properly?

https://github.com/guard/notiffany#usage

Notiffany should be translating the :image option as here:

https://github.com/guard/notiffany/blob/90966c71fd2b184a176094294f194c85f1d7f070/lib/notiffany/notifier/base.rb#L110

... and translate it to a file as here:

https://github.com/guard/notiffany/blob/90966c71fd2b184a176094294f194c85f1d7f070/lib/notiffany/notifier/base.rb#L75

So I'm not sure what exactly isn't working and I'm a Linux user so AFAIK. I don't have time to set up a http://www.macincloud.com reproducing the problem, so I can't do much until someone points out where the bug is.

(If I get a reasonably non-invasive PR I can merge and quickly release).