Skip to content

Instantly share code, notes, and snippets.

@mhuggins
Last active December 30, 2016 07:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhuggins/d91a752684e552c05321 to your computer and use it in GitHub Desktop.
Save mhuggins/d91a752684e552c05321 to your computer and use it in GitHub Desktop.
Fix ActionController::UrlGenerationError for controller tests in Rails engines
# spec/support/helpers/controller_helpers.rb
module ControllerHelpers
extend ActiveSupport::Concern
included do
routes { ProfileApi::Engine.routes }
end
end
# spec/rails_helper.rb
Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
RSpec.configure do |config|
config.include ControllerHelpers, type: :controller
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment