New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added GrowlAgent for sending Growl notifications over GNTP #172
Conversation
register_growl | ||
message = (event.payload['message'] || event.payload['text']).to_s | ||
subject = event.payload['subject'].to_s | ||
if message != "" && subject != "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be written as
if message.present? && subject.present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah thanks! My ruby-fu is weak, I forget about all the niceties afforded by the language.
Thanks @snicker, this looks great! Would you mind adding a couple basic specs for it? |
Sure thing. |
Added a few, probably could use a few more. New to rspec, is rspec mocks not included in this project? I couldn't stub the Growl object and needed to prevent it from sending real growl messages to a nonexistent destination or the tests would fail |
Thanks! We're using a library called rr for mocking instead of rspec On Monday, March 3, 2014, snicker notifications@github.com wrote:
|
Ahh! perfect, that looks pretty easy. I'll add a few more specs. |
finally had a moment to learn some more about rr, committed a bunch more specs... this should be ready to go |
message = "message" | ||
subject = "subject" | ||
any_instance_of(Growl) do |obj| | ||
mock(obj).notify(@checker.options[:growlnotificationname],subject,message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend also ensuring that this block gets called
called = false
any_instance_of(Growl) do |obj|
called = true
mock(obj).notify(@checker.options[:growlnotificationname], subject, message)
end
@checker.notify_growl(subject, message)
called.should be_true
Nice work! |
Made those changes, I'm all about style |
Added GrowlAgent for sending Growl notifications over GNTP
Great work @snicker, thanks for getting involved! |
sure thing! glad to contribute, this is an awesome project. Still trying to find more reasons for using it other than letting me know if it's raining! Is there a collection of use cases that others are using it for? I hopped in IRC but it's pretty dead. |
Yea, it's been quiet recently but I try to idle there. Feel free to post On Thursday, March 6, 2014, snicker notifications@github.com wrote:
|
Added GrowlAgent for sending Growl notifications over GNTP
supports sending Growl messages over GNTP to network clients.