“...I've been working since 2008 with Ruby / Ruby on Rails, love a bit of Elixir / Phoenix and learning Rust. I also poke through other people's code and make PRs for OpenSource Ruby projects that sometimes make it. Currently working for InPay...”

Rob Lacey (contact@robl.me)
Senior Software Engineer, Brighton, UK

Rails 5.1 testing

Today I got almost 300 spec errors when flipping our core app to use Rails 5.1. Why? Well, it’s just syntax in controller, request specs but the syntax makes things much clearer and is probably a welcome change if not a time consuming fix.

get :show, { :id => 1 }, { 'HTTP_REFERER' => '/something' }
get :show, params: { :id => 1 }, headers: { 'HTTP_REFERER' => '/something' }

Now XHR requests are being wonky.

xhr :show, params: { :id => 1 }
     NoMethodError:
       super: no superclass method `xhr' for #<RSpec::ExampleGroups

Ok that’s make sense.

get :show, :xhr => true, params: { :id => 1 }