Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should my rspec helpers go?

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

I am not trying to test an app helper and I do not feel like creating an app helper that will only be used for testing.

What is the good practice?

Thanks,

like image 799
RaySF Avatar asked Apr 28 '12 06:04

RaySF


1 Answers

Typically I put these in spec/support/spec_helpers. I then include those modules in the appropriate examples.

If you have some that are useful to all specs of a certain type (e.g. all request specs) then you can do

config.include SomeHelper, :type => :request

which will include that module into all your request example groups.

like image 61
Frederick Cheung Avatar answered Nov 23 '22 04:11

Frederick Cheung