Search code examples
rubyautomated-testscapybara

How to use multiple spec_helper.rb files


I would like to create and use more than one "spec_helper.rb" to set up different block of codes for each project.

Is that possible? If so, how can I call a specific "spec_helper.rb" in my test file?


Solution

  • spec_helper.rb is not special, it's just a ruby file that you then require from other files (generally the files that define your specs). You can change the name (or have multiple differently named files) that you then require when needed.

    Beyond that your question asking about setting up different blocks of code for different projects doesn't make a lot of sense since different projects would each have their own spec_helper.rb by default.