How do I set HTTP_REFERER when testing in Rails?

后端 未结 7 1294
我在风中等你
我在风中等你 2020-12-05 22:12

I\'m trying to test a controller and I got this error. I understand the error, but don\'t know how to fix it.

test: on CREATE to :user with completely invali         


        
7条回答
  •  春和景丽
    2020-12-05 23:10

    Their recommendation translates to the following:

    setup do
      @request.env['HTTP_REFERER'] = 'http://test.com/sessions/new'
      post :create, { :user => { :email => 'invalid@abc' } }
    end
    

提交回复
热议问题