In order to avoid adding
request.env["HTTP_REFERER"] = '/'
to a before block on every controller_spec file I create, I have tried to add this to the global config (in spec_helper.rb)
config.before(:each) {request.env["HTTP_REFERER"] = '/'}
The problem is, I get the following error:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.env
Has anyone any pointers on how to implement this correctly?
Cheers!