Read more

Properly require your "spec_helper"

Tobias Kraze
June 22, 2012Software engineer at makandra GmbH

You can configure RSpec to automatically require spec_helper.

Always use simply

require 'spec_helper'
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

If you mix it up like

require 'spec_helper'
require File.dirname(__FILE__) + '/../spec_helper'
require File.dirname(__FILE__) + '/../../spec_helper'
require File.expand_path('spec/spec_helper')

the file will be executed each time, since Ruby (at least 1.8) identifies it simply by the string you passed to "require".

Posted by Tobias Kraze to makandra dev (2012-06-22 13:44)