Sha256: ae729e855695f195fa055338aa3e92c122b77f1fdd63b7500eae8734fa643c9e

Contents?: true

Size: 668 Bytes

Versions: 4

Compression:

Stored size: 668 Bytes

Contents

module ActionController
  class TestRequest < ActionDispatch::TestRequest

    #
    # Transforms Raisin controller's path as a standart Rails path
    # before assigning parameters to the request
    #
    # Example:
    #   controller_path: 'users_api#index', action: 'index'
    #   becomes
    #   controller_path: 'users', action: 'index'
    #
    def assign_parameters_with_api(routes, controller_path, action, parameters = {})
      controller_path.sub!(/_api/, '')
      controller_path.sub!(/\/?#{action}/, '')
      assign_parameters_without_api(routes, controller_path, action, parameters)
    end

    alias_method_chain :assign_parameters, :api
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
raisin-0.0.5 lib/raisin/testing/rspec/test_request.rb
raisin-0.0.4 lib/raisin/testing/rspec/test_request.rb
raisin-0.0.2 lib/raisin/testing/rspec/test_request.rb
raisin-0.0.1 lib/raisin/testing/rspec/test_request.rb