routing_spec.rb 430 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe WelcomeController, type: :routing do
  4. it 'routes to #root' do
  5. expect(get('/')).to route_to('welcome#root')
  6. end
  7. context 'all other paths' do
  8. it 'routes to welcome#root' do
  9. path = Faker::Lorem.word
  10. expect(get("/#{path}")).to route_to(
  11. controller: 'welcome',
  12. action: 'root',
  13. path: path,
  14. )
  15. end
  16. end
  17. end