Methods
A
T
Included Modules
Constants
Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| app.draw do ok = lambda { |env| [200, { 'Content-Type' => 'text/plain' }, []] } get '/string', to: ok, constraints: { format: 'json' } get '/regexp', to: ok, constraints: { format: /json/ } get '/json_only', to: ok, format: true, constraints: { format: /json/ } get '/xml_only', to: ok, format: 'xml' end end
 
APP = build_app Routes
 
Instance Public methods
app()
# File actionpack/test/dispatch/routing_test.rb, line 4474
def app; APP end
test_enforce_with_format_true_with_constraint()
# File actionpack/test/dispatch/routing_test.rb, line 4498
def test_enforce_with_format_true_with_constraint
  get 'http://www.example.com/json_only.json'
  assert_response :success

  get 'http://www.example.com/json_only.html'
  assert_response :not_found

  get 'http://www.example.com/json_only'
  assert_response :not_found
end
test_enforce_with_string()
# File actionpack/test/dispatch/routing_test.rb, line 4509
def test_enforce_with_string
  get 'http://www.example.com/xml_only.xml'
  assert_response :success

  get 'http://www.example.com/xml_only'
  assert_response :success

  get 'http://www.example.com/xml_only.json'
  assert_response :not_found
end
test_regexp_format_constraints()
# File actionpack/test/dispatch/routing_test.rb, line 4487
def test_regexp_format_constraints
  get 'http://www.example.com/regexp'
  assert_response :success

  get 'http://www.example.com/regexp.json'
  assert_response :success

  get 'http://www.example.com/regexp.html'
  assert_response :not_found
end
test_string_format_constraints()
# File actionpack/test/dispatch/routing_test.rb, line 4476
def test_string_format_constraints
  get 'http://www.example.com/string'
  assert_response :success

  get 'http://www.example.com/string.json'
  assert_response :success

  get 'http://www.example.com/string.html'
  assert_response :not_found
end