Skip to content

Instantly share code, notes, and snippets.

@jarodreyes
Created May 13, 2011 18:27
Show Gist options
  • Save jarodreyes/971040 to your computer and use it in GitHub Desktop.
Save jarodreyes/971040 to your computer and use it in GitHub Desktop.
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