Skip to content

Instantly share code, notes, and snippets.

View Bot Implementation Research.md

Hubot

  • Flow of Input -> Output is managed via Adapters and Hubot's "core" robot functionality. Adapters are initialized with a Hubot instance. They forward messages directly to the robot instance. They are also responsible for building a reply back to the source.
  • Architecturally the Hubot (robot core) is aware of the adapter, and the adapter is aware of hubot.

Here's what a quick implementation looks like with SlackBot: https://github.com/slackhq/hubot-slack/blob/master/src/bot.coffee

create Hubot instance -> create adapter instance -> run

To view the sequence diagram, use jay's chrome extension

View Testing & Duck Typing with Ruby.md

Fairly recently we investigated a runtime error while running cron jobs against our subscription purchases. The error stemmed from a class mismatch when a method method_foo was returning a SubscriptionFoo object when we were expecting a SubscriptionBar object. The solution was fairly straight forward, however writing a well-scoped test for method_foo and its return value was not. Why? Because it is often overlooked to write well-scoped tests for relatively large applications in favor of writing narrow-scoped tests that strictly test what you want. Tests should be just as scalable, flexible and maintainable as our main code.

The initial attempt was to test method_foo's class return types: SubscriptionFoo or SubscriptionBar. The code was relatively simple:

describe FooBar do
  describe '#method_foo' do
    context 'when it should return a SubscriptionTypeFoo' do
      ...
View Rails 4 Task list.md

This list might not be prioritized correctly however it is a general checklist so that our lumos_rails app is properly updated to rails 4.0.13:

  • Get specs running & working
  • Make sure rake tasks are working properly (migrations, and other db tasks involving active record)
  • remove protected_attributes in favor of strong paramters
  • Remove deprecated syntax with respect to scopes and active_record relational (example use procs)
  • remove .css.sass file extensions in favour of just .sass extensions
  • Update dummy + main app config files to reflect rails 4 configurations.