[rspec-users] Testing User Agent

Suprie Leonhart suprie.leonheart at gmail.com
Wed Feb 25 02:57:38 EST 2009


i'm testing some lib i've made for detecting mobile user agent, I confused
how to test the lib i've made.
the test code is


  describe "Check if mobile browser" do
    it "should know if it's from blackberry" do
      blackberry_ua = "BlackBerry8330/4.3.0 Profile/MIDP-2.0
Configuration/CLDC-1.1 VendorID/105"
      request.env["HTTP_USER_AGENT"] = blackberry_ua
      is_mobile?.should == true


the error is, request variable always nil

the question : how i mock the request.env ?

Best Regards

"Mendapat upah karena menyenangkan orang lain yang tidak punya persangkutan
dengan kata hati sendiri, kan itu dalam seni namanya pelacuran?"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090225/f3d743b4/attachment.html>

More information about the rspec-users mailing list