I wanted to test sorting (jsonapi). The sortable fields were:

id, name, description, created_at, overdue_tasks, my_overdue_tasks, archived

Let’s bring in some order with this command:

'<,'>!perl -ne '$,=" ";print sort split /\s+/'
archived created_at, description, id, my_overdue_tasks, name, overdue_tasks,
describe '#index-sorting' do
  subject { jsonapi_resource_results }

  %w(archived, created_at, description, id, my_overdue_tasks, name, overdue_tasks).each do |field|
    it_behaves_like 'is able to sort elements', field
  end
end

All kudos go: http://stackoverflow.com/a/1328106

This protip has been written in 667 seconds