slack-ruby/slack-ruby-bot

slack-ruby-bot rspec doesn't log no bot response properly. Reports undefined method count for nil:NilClass

Closed this issue · 4 comments

There seems to be a bug inslack-ruby-bot-0.12.0/lib/slack-ruby-bot/rspec/support/slack-ruby-bot/respond_with_slack_message.rbat this line message += @messages.count.zero? ? 'No response messages received' : @messages.inspect

In the example below you can see that the code throws a undefined method count for nil:NilClass error when there is no message instead of reporting that the No response messages received message to the user.

Failures:

  1) Bot listens for anything to do with VPN and refers user to help channel
     Failure/Error:
       expect(message: 'I am locked out of the vpn', channel: CHANNEL)
         .to respond_with_slack_message our_response

     NoMethodError:
       undefined method `count' for nil:NilClass
     # ./spec/8_bot_spec.rb:14:in `block (3 levels) in <top (required)>'

Finished in 0.53769 seconds (files took 0.93579 seconds to load)
47 examples, 1 failure

Please do fix, PRs welcome!

This has been fixed on master, but there has not been a proper gem release since the fix, so it would be nice to get that before we officially close this issue.

Would prefer to pin to an official release version instead of a branch or specific commit hash.

Which PR fixed this? Let's close it with that. I'll cut a release when I get to it.