Read more

RSpec 3 no longer chooses a spec's type based on its directory

Arne Hartherz
July 22, 2014Software engineer at makandra GmbH

While RSpec 1 and 2 decided that specs inside spec/model are model specs, and those inside spec/features are feature specs (and so on), RSpec 3 will no longer do that by default.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

This will result in errors such as missing routing helpers, etc.

There are 2 ways to fix this:

  • Explicitly set the type on each spec. For example:

    describe '...', type: 'feature' do
      # ...
    end
    
  • Add this to your spec_helper.rb (inside the RSpec.configure block) to restore the old behavior Show archive.org snapshot :

    config.infer_spec_type_from_file_location!
    
Posted by Arne Hartherz to makandra dev (2014-07-22 09:26)