background preloader

Testing

Facebook Twitter

Browserling - interactive cross-browser testing. WebHookApp - The WebHook and HTTP debugging tool. Different ways of code reuse in RSpec « Test Driven Websites (TDD and BDD in RoR and JS) Hierarchical structure of RSpec, with nested context/describe blocks and hierarchical before/after hooks, topped with a bit of syntactic sugar like let/let! Methods, already goes a long way towards clean and readable tests. However, more complex suites still can quickly go un-DRY and unwieldy without code reuse between example groups. Fortunately, RSpec provides several different tools for reusing test code: helper methods and modules, custom matchers, shared examples and shared contexts. It also allows to create examples programmatically (eg. in a loop). In this post I’ll briefly introduce all these options and discuss use cases for each of them.

To encapsulate common, complex logic RSpec allows you to write arbitrary helper methods directly within an example group (or in a parent example group): To make helper methods even more reusable (between multiple, not nested example groups), it is possible to define them in a module: and then include it in your example: you can do it this way: Mailtrap - perfect service for debugging your application's e-mail notifications. PhantomJS: Headless WebKit with JavaScript API.