class RequestValidationController < ApplicationController
    
  @@redirect_for_bad_request = '/error'
  
  def none
    validate_request(:get) or return
    render_text('success')
  end  
  
  def one_integer
    validate_request(:get, :id => :integer) or return
    render_text('success')
  end
  
  def two_integers
    validate_request(:get, :id => :integer, :count => :integer) or return
    render_text('success')
  end
  
  def one_specific
    validate_request(:get, :orientation => 'horizontal') or return
    render_text('success')
  end
  
  def one_integer_one_specific
    validate_request(:get, :id => :integer, :orientation => 'horizontal') or return
    render_text('success')
  end  
  
  def get_only
    validate_request(:get) or return
    render_text('success')
  end

  def post_only
    validate_request(:post) or return
    render_text('success')
  end

  def put_only
    validate_request(:put) or return
    render_text('success')
  end

  def get_or_post
    validate_request([:get, :post]) or return
    render_text('success')
  end
  
  def one_required_integer_one_optional_integer
    validate_request(:get, {:id => :integer}, {:per_page => :integer}) or return
    render_text('success')
  end
  
end

class RequestValidationController < ActionController::Base
    
  @@redirect_for_bad_request = '/error'
  
  def none
    validate_request(:get) or return
    render_text('success')
  end  
  
  def one_integer
    validate_request(:get, :id => :integer) or return
    render_text('success')
  end
  
  def two_integers
    validate_request(:get, :id => :integer, :count => :integer) or return
    render_text('success')
  end
  
  def one_specific
    validate_request(:get, :orientation => 'horizontal') or return
    render_text('success')
  end
  
  def one_integer_one_specific
    validate_request(:get, :id => :integer, :orientation => 'horizontal') or return
    render_text('success')
  end  
  
  def get_only
    validate_request(:get) or return
    render_text('success')
  end

  def post_only
    validate_request(:post) or return
    render_text('success')
  end

  def put_only
    validate_request(:put) or return
    render_text('success')
  end

  def get_or_post
    validate_request([:get, :post]) or return
    render_text('success')
  end
  
  def one_required_integer_one_optional_integer
    validate_request(:get, {:id => :integer}, {:per_page => :integer}) or return
    render_text('success')
  end
  
end

Fix small setup item so that tests pass.
Fix small setup item so that tests pass.

git-svn-id: b46a55edd163d01e6c678d43094a9b8c8fe8b18e@6639 da5c320b-a5ec-0310-b7f9-e4d854caa1e2
