Rspec: how to spec request.env in a helper spec?

后端 未结 5 1823
忘掉有多难
忘掉有多难 2021-02-12 13:36

In my helper module, I have:

def abc(url)
  ...
  if request.env[\'HTTP_USER_AGENT\']
    do something
  end
end

In my spec file, I have:

5条回答
  •  名媛妹妹
    2021-02-12 14:10

    If you're using rspec-rails, you might be able to use controller.request in your helper tests.

提交回复
热议问题