Feature spec can not find request.user_agent

13 views
Skip to first unread message

Ester Ytterbrink

unread,
Dec 12, 2014, 7:38:25 AM12/12/14
to rs...@googlegroups.com
Hi!
I have an old feature spec (it lives in the feature folder) in the project where I work right now

it 'can visit each foo' do
    @foos.each do |foo|
      visit foo_path(foo)
      [302, 200].include?(page.status_code).should be_truthy
    end
  end


Except for not using expect and being a non optimal test it broke totally when the page rendered by foo_path started to use a helper that checks request.user_agent (since it obviously do not exist in that context)
How do I solve that?

Should the test live somewhere else? Use something else than visit?

Thank you beforehand!
Ester Ytterbrink

Jon Rowe

unread,
Dec 12, 2014, 4:09:42 PM12/12/14
to rs...@googlegroups.com
You need to set the header that generates the user agent

Jon Rowe
---------------------------

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/436e2bfa-858f-40a6-98f3-9733ffab650e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages