Vi är två bröder som båda studerat till civilingenjörer med ett stort intresse för teknik, mjukvara och entreprenörskap.


  • Published on

    Rails system tests with Cuprite - attach_file

    Cuprite is a pure Ruby driver for Capybara and a replacement for Selenium.

    When using the Capybara method attach_file in your system tests, you might run into

    Ferrum::TimeoutError: Timed out waiting for response. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the :timeout option to a higher value might help.
    Ferrum::BrowserError: Internal error
  • Published on

    Blinka - Connecting Heroku CI to Github

    Heroku CI (continuous integration) runs tests in an environment very similar to an Heroku application, the code is packaged into a slug and runs on a dyno.

    With Heroku's Github Integration it can automatically run CI-builds for every commit, then report back to Github with a pass or fail status and a link. The test results can be parsed if they are reported in the TAP-format, but it still stays on Heroku and is not visible on Github.

    Heroku status reported to Github without any test results, just pass or fail.
    What if we could get the number or failing tests, error messages, backtraces and even screenshots directly to Github?

    This is why I built Blinka🚦!

  • Published on

    Rails Dual-boot + Dependabot = 💔?

    There are two concepts which greatly affected how I work with Rails development during the last couple of years, specifically with dependency management and preparing for upgrading to the next Rails version.

    The first one is Dependabot which opens pull-requests to update one dependency at a time. This way of working felt natural at once and allowed me to be on top of dependency updates instead of being scared of it 👻.

    The second one is dual-booting my Rails applications using separate lock-files, I was introduced to this concept by fastruby.io and their blog post Getting Ready for Rails 6.0: How to Dual Boot.

    Unfortunately the two do not work well together out of the box 💔.

  • Published on

    Error when converting PDF to image on Github Actions

    MiniMagick::Error: `convert /tmp/shrine20201009-22018-5itpj9.pdf[0] -auto-orient /tmp/image_processing20201009-22018-1uk39lv.png` failed with error:
    convert-im6.q16: not authorized `/tmp/shrine20201009-22018-5itpj9.pdf' @ error/constitute.c/ReadImage/412.
    convert-im6.q16: no images defined `/tmp/image_processing20201009-22018-1uk39lv.png' @ error/convert.c/ConvertImageCommand/3258.
        app/uploaders/document_uploader.rb:13:in `block in <class:DocumentUploader>'
        test/jobs/documents/documents_upload_job_test.rb:8:in `block in <class:UploadJobTest>'

    In my Ruby on Rails application, this error is raised when using MiniMagick to convert a PDF into an image. MiniMagick uses ImageMagick which uses Ghostscript for anything related to postscript files - for example PDFs.

    Due to a security vulnerability in Ghostscript < 9.24, ImageMagick changed the default policy to not allow conversions using Ghostscript. Even if Ghostscript has fixed the vulnerability, the ImageMagick policy has not been changed.

  • Published on

    Rails - Minitest results output in TAP-format for Heroku CI

    Originally posted on my DEV.to page.

    When using Heroku CI for automatic testing, the default output is just pass or fail without any parsing of how many tests passed or what errors where found.

    This can be improved if you output the results in the Test Anything Protocol-format (TAP-format) according to Heroku.

    This format is not built into the test frameworks used in Ruby on Rails. Therefore I had to write my own test reporter.