Using your ruby-webmock configuration for your local test service

An article, posted more than 5 years ago filed in docker, development, rails, ruby, VCR, testing, resources, laptop & offline.

I recently shared an overview article about Stubbing External Services in Rails. I found it when looking for the best way to stub a pletora of services in a microservices environment. Sure, docker (or whatever) everything and run it locally / in your test suite. But unless you've plenty of disk- and memory space, this isn't always a viable option. The alternative: simulate the service. Mock or stub the endpoint.

VCR and Webmock

The go to gems are Webmock, which catches request and allows you to define the responses explicitly and VCR, which allows you to record responses, and play back.

VCR is quite cool, but as it is a recorder of earlier responses, there may be a lot of noise to dig trough when trying to make the responses a bit more generic (dealing with random token requests and what else)

For testing I pers…

Continue reading...

Learning from failures: off-line support in a rails-app

An article, posted more than 8 years ago filed in rails, react, ruby, frontend, backend, offline, online, app, nodejs, ruby on rails, formdata, forms & cache.

As a web-developer you typically assume that your users are always using your app on-line. When asked a year ago to start developing an app for the art-consulting firm QKunst I was, however, specifically asked for a tool that had to work in bunkers. Bunkers where having a solid internet connection was typically the exception. No problem, I read about HTML5 and offline app-cache: I thought I could fix that. More about that soon.

How I face a challenge

When faced a (technical) challenge I typically search for the easiest way out: what would be the slightest change I’d have to make to my battle tested set-up to accommodate for the new challenging feature. In my case this battle tested set-up starts of with the Ruby on Rails stack, which builds on techniques that align well with how I believe the web should work too. RESTful (proper HTTP-messaging and URLs), semantic, CURL-able. And all graceful…

Continue reading...

Gegevens moeten zo min mogelijk onderweg zijn

Zou het mogelijk zijn om vuistregel te definiëren voor of iets nu beter een online applicatie kan zijn, draaiend op een externe server, of een lokaal draaiende app? In de evolutie van computer systemen lijkt het er op alsof we steeds zitten te flip-floppen tussen het draaien van de applicatie op het apparaat dat we gebruiken en het draaien van de applicatie op een apparaat ver weg. Vroeger hadden we terminals gekoppeld aan mainframes, toen kwamen er desktop PC's die alles lokaal deden en nu twijfelen we tussen Apps lokaal en webapps in “de cloud”, ook ik.

Gevoelsmatig zeg ik (op dit moment): Krantenapps? TV apps? Geen lokale apps: gewoon volledig online. Fotografeer apps, tekstschrijf apps, zinvol, waarom online doen? Maar het interessante is natuurlijk het grijze midden. De door jouw geselecteerde muziek? Een feedreader, met feeds die jij hebt geselecteerd? Schrijfapplicaties die je in staat stellen samen te werken…

Continue reading...

murb blog