Joined August 2011
·

Michael Grosser

Zendesk
·
San Francisco
·
·
·

Posted to Rails: add a route for a test over 1 year ago

simpler/dry version

describe ApplicationTestController do
  routes ApplicationTestController
 ... tests ...
end



def self.routes(controller)
    before do
      controller_name = controller.to_s.underscore.chomp('_controller')
      Rails.application.routes.draw do
        match "test/:action", controller: controller_name, via: [:get, :post, :patch, :delete]
      end
    end

    after do
      Rails.application.reload_routes!
    end
  end

alias_method :context, :describe

proxy_set_header X-Forwarded-Proto $scheme
Achievements
167 Karma
0 Total ProTip Views