I want to test javascript code from a ruby context. Specifically, I want to setup my database with ruby, query it with my javascript model, and confirm my javascript state from ruby. I want to do this without mocking.
I've tried simply loading my client libraries into a v8 context, but that causes therubyracer to choke in all sorts of ways (window not defined
, userAgent not defined
, etc).
Further I'm using headless browsers to test my javascript code, but they don't provide me the ruby context I need to leverage for these cases.
I think I need to load a browser (or a dom simulator) into a v8 context, but i don't what libraries are out there to do this. Maybe you have another idea?
How can I do this?