Skip to content

Instantly share code, notes, and snippets.

@vmcilwain
Last active June 4, 2018 14:03
Show Gist options
  • Save vmcilwain/969b1c67c610f1967d25d1b44a6d2564 to your computer and use it in GitHub Desktop.
Save vmcilwain/969b1c67c610f1967d25d1b44a6d2564 to your computer and use it in GitHub Desktop.
Rails 4.2.0 Engine RSpec main app routing
# spec/support/main_app.rb
module MainAppRoute
def main_app
Rails.application.class.routes.url_helpers
end
end
# In spec/rails_helper
RSpec.config do |config|
config.include MainAppRoute
end
# Then in the controller specs
it 'redirects to main_app.root_path' do
expect(response).to redirect_to main_app.root_path
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment