RSPEC: Is it possible to run other spec file inside a spec file RSPEC: Is it possible to run other spec file inside a spec file selenium selenium

RSPEC: Is it possible to run other spec file inside a spec file


You really want to be able to run tests independently. Having to run all tests, even "just" all tests in a given file, seems to me like an unacceptable delay in the development process. It also makes in hard to use tools like Guard that run tests for you based on a file watcher.

If there is really something that needs to run before, for example, every request spec, you can do something like:

# spec_helper.rbRSpec.configure do |config|  config.before :all, type: :request do    # do stuff  endend

But also look at what you are trying to do. If you are just setting up model/database data for the tests, then you want fixtures, or better yet, factories. Look into FactoryGirl.


Perhaps organizing your tests with context and using before(:each) and before(:all) judiciously would yield a performance boost. Simplifying the database, or using a library like FactoryGirl can also help.