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:
Well, you've almost nothing to do:
before(:each) do
@meth = :abc
request.env['HTTP_USER_AGENT'] = "..."
end
I just gave this another try and this passes:
#in helper
def foo
request.env['HTTP_USER_AGENT']
end
#spec
it "foo" do
helper.request.env['HTTP_USER_AGENT'] = 'foo'
expect(helper.foo).to eq 'foo'
end