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:
You can override user-agent set in the request env by doing the following.
before(:each) do @meth = :abc helper.request.user_agent = 'something else' end
Then, in your spec:
it "does stuff" do expect(helper.send(@meth, "some_url")).to # ... end