Sha256: d1adcb83944ec585e669fb9113950563e54e652ad6bc39c645ba051f706550f1

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

require 'action_pack'

module ActionControllerHelpers

  def mock_controller_with_session(request = nil, session={})

    query_parameters = {:ticket => "bogusticket", :renew => false}
    parameters = query_parameters.dup

    #TODO this really need to be replaced with a "real" rails controller
    request ||= mock_post_request
    request.stub(:query_parameters) {query_parameters}
    request.stub(:path_parameters) {{}}
    controller = double("Controller")
    controller.stub(:session) {session}
    controller.stub(:request) {request}
    controller.stub(:url_for) {"bogusurl"}
    controller.stub(:query_parameters) {query_parameters}
    controller.stub(:path_parameters) {{}}
    controller.stub(:parameters) {parameters}
    controller.stub(:params) {parameters}
    controller
  end

  def mock_post_request
      mock_request = ActionController::Request.new({})
      mock_request.stub(:post?) {true}
      mock_request
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubycas-client-2.3.9 spec/support/action_controller_helpers.rb
rubycas-client-2.3.9.rc1 spec/support/action_controller_helpers.rb