Skip to content

Instantly share code, notes, and snippets.

@elricstorm
Created May 19, 2011 14:25
Show Gist options
  • Save elricstorm/980857 to your computer and use it in GitHub Desktop.
Save elricstorm/980857 to your computer and use it in GitHub Desktop.
# When requesting mobile you can set the request environment two ways
# @request.env['HTTP_ACCEPT'] = "mobile"
# OR
# @request.accept = "mobile"
require 'test_helper'
class HomeControllerTest < ActionController::TestCase
test "should get mobile index" do
@request.accept = "mobile"
get :index
assert_response :success
assert_select "div[data-role=header]" do
assert_select 'h1', 'Your Header Title'
end
end
end
<div data-role="header">
<h1>Your Header Title</h1>
</div>
Mime::Type.register_alias "text/html", :mobile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment