Where are my rspec helpers?

I would like to write a helper that will only be used in my spec files, and I don't know where this code should go.

I am not trying to test the application assistant, and I do not want to create an application assistant that will be used only for testing.

What is good practice?

Thanks,

+7
source share
1 answer

I usually put them in spec/support/spec_helpers . Then I include these modules in the relevant examples.

If you have some that are useful for all specifications of a certain type (for example, for all specifications of queries), you can do

 config.include SomeHelper, :type => :request 

which will include this module in all of your sample query groups.

+10
source

All Articles