Skip to content

Allow the set the controller spec routes globally. #1226

Closed
@tvdeyen

Description

@tvdeyen

For testing controllers in an rails engine one can set the engine routes inside the controller spec file:

https://www.relishapp.com/rspec/rspec-rails/v/3-1/docs/controller-specs/engine-routes-for-controllers

Great, but it is very tedious to set this in every single controller spec. Especially for large rails engines, like spree or alchemy.

It would be great if one could set the routes globally like this:

# spec_helper.rb
RSpec.configure do |config|
  config.before(:each) do
    # Load the routes for controller specs
    if example.metadata[:type] == :controller
      example.routes { Alchemy::Engine.routes }
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions