Created
May 13, 2011 18:27
-
-
Save jarodreyes/971040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_filter :iphone_redirect | |
def iphone_redirect | |
if request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/] | |
redirect_to "http://itunes.apple.com/us/app/messageparty/id386579657?mt=8" | |
end | |
end | |
describe ApplicationController do | |
it 'should redirect request from mobile safari to the app store' do | |
request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5' | |
get :controller => :messages, :action => :index | |
response.should redirect_to "http://itunes.apple.com/us/app/messageparty/id386579657?mt=8" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment