Good test, bad test

I ❤ tests! They give me confidence that the code does what it’s supposed to do, they document behaviour, they let me discover edge cases when writing the code in the first place. All tests are not created equal, though, and I don’t love them all the same. I’d like to put into words what are the properties which make tests good but… it depends. It depends on many factors: language, type of test, trust in cooperating components, criticality of the code under test, cost of running a test, time pressure and many more. Read On →

We're looking for developers to help us save energy

If you're interested in what we do and you would like to help us save energy, drop us a line at

Writing custom native Ruby extension in C from scratch

You are probably reading this because you have an idea for a useful library for Ruby and you did not find it already implemented on I was in the same boat, implemented it and here is how: Quick initialization of a Ruby gem Creating a Ruby module and a Ruby class in C Creating instance methods in C for the Ruby class Publishing the gem to Adding more C files to the compilation But first, let’s set our goal here Ok, you have your goal set, and we have to do the same here. Read On →

Adding rubocop-rspec to a legacy codebase

In a recent article I described how to use rspec --bisect tix flaky tests. Apart from the test failures described in that post, we’ve also encountered another problem: #<Double (anonymous)> was originally created in one example but has leaked into another example and can no longer be used. rspec-mocks' doubles are designed to only last for one example, and you need to create a new one in each example you wish to use it for. Read On →

Eliminating order-dependent test failures using `rspec --bisect`

Last week, we’ve dedicated some time to improving reliability of the Enectiva test suite. Enectiva is a non-trivial application, so its test suite is coming up to 9K test cases and weird stuff can happen. As with any project older than a few months, there are tests of varying quality and value. Using the scout rule, we try to improve the tests bit by bit, but sometimes more targeted action is called for. Read On →

Binary data series analysis using Postgres window functions

Few releases back, we introduced a new feature in Enectiva: analysis of binary data series. This feature allows our customers to make sense of data coming from sensors monitoring things like lights turned on by motion, gates and doors being open or anything that can be on/off, open/closed. The primary presentation of this data we were working towards looks like: Each series has its line with intervals when the lights were turned on displayed as wider stripes in dark blue. Read On →

Printing HTML & CSS

To internet people, it makes no sense to print websites. Not all people are internet people though and some time ago a requirement to print a report page landed on our road map. Here are the obstacles we encountered. Print stylesheet linking and Webpack Print stylesheets are typically a giant list of .menu, .footer, ... { display: none } hiding all navigation and interactive elements. This gets applied on top of the default stylesheet. Read On →

Rails 5 Test Prescriptions: Build a Healthy Codebase - reading notes

I finished reading Rails 5 Test Prescriptions: Build a Healthy Codebase - reading notes by Noel Rappin. It contains exactly what it claims in its lengthy title. It discusses testing in more general terms (but doesn’t go deep into motivation for testing as many books do), describes different categories of tests and puts them into practice with Rails 5 approach. Compared to other books, this is actually pretty hands-on text. Rappin uses a simple project management app as an example to demonstrate the various approaches throughout the book. Read On →

Remote testing with ngrok

Testing websites and web applications across platforms, browsers and operating systems is a nightmare. Browsers' developer tools have made it much more convenient over the years with respect to mobile but still, you can’t simulate IE in Firefox or weird “improvements” some OS + browser combinations make (I’m looking at you, Safari on an iPhone). There’s no getting around of running the browser on an actual device. However, getting the website/app running somewhere accessible can be a bit of a problem. Read On →

IE, Webpack and strict mode

Supporting Internet Explorer is one of those phrases which spoken aloud makes a person bang their head against the nearest hard surface if they’ve been in web development for longer than two weeks. Don’t get me wrong, it used to be much much worse back in the day of IE6 and IE7 and supporting Edge is several orders of magnitude less stress inducing (and Microsoft did a good job of branding Edge to put some distance between Edge and IE). Read On →

Multi-caret mode in IntelliJ Idea

After seeing it used very effectively in several screencasts I finally decided to learn the keyboard shortcuts to for multi-line/multi-caret selection and editing in IntelliJ Idea. There are two ways how to go about it: Switch from line-selection mode to column-selection mode, by default Alt + Shift + Insertand then hold Shiftand press an up/down arrow key to spread the caret to as many lines as you need, or Press Ctrl, release it, press Ctrlagain and hold it and press an up/down arrow key again as much as you need Personally, I like the first one even though it seems bit more cumbersome. Read On →