wtorek, 27 października 2015

Refactoring - Value Object

Wanted to share neat refactor I've made some time ago

The all this is about keeping the same interface for adding new fields, in fact it is just creating nice Value Object
After quick search on internet it looks it is not good idea to inherit from Hash directly.
Hopefully we can create objects with []= operator so it behaves like Hash.

For generating proper output we need to write format() method that will convert booleans into required format.

Here You can see proper Value Object and it's usage compared to old code.


One bad thing about ruby: looks like you can't just tell in one operation that something is boolean, you need to check if it is TrueClass or FalseClass.

sobota, 19 września 2015

How to test video player in phantomjs

TL;DR;
You can't. Go home and use selenium.



Phantomjs just doesn't support video tag. What you can do is to change your app to emulate video element api, not great but something. The nice thing about this you can speed time ;)