Sha256: 1509ea8d11d5720f0e80ede54ea54492f298a3d404748886c69c18dbf371f0af
Contents?: true
Size: 991 Bytes
Versions: 39
Compression:
Stored size: 991 Bytes
Contents
require 'rails_helper' require 'sorbet-rails/routes_rbi_formatter' RSpec.describe SorbetRails::RoutesRbiFormatter do it 'sets up Rails Application' do expect(Rails.application.routes).to_not be_empty end it 'generates _path and _url of a named route' do all_routes = Rails.application.routes.routes require "action_dispatch/routing/inspector" inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes) formatted = inspector.format(SorbetRails::RoutesRbiFormatter.new) expect_match_file(formatted, 'expected_routes.rbi') end it 'generates correctly when there is no routes' do empty_set = ActionDispatch::Routing::RouteSet.new empty_set.draw do # no routes end require "action_dispatch/routing/inspector" inspector = ActionDispatch::Routing::RoutesInspector.new(empty_set.routes) formatted = inspector.format(SorbetRails::RoutesRbiFormatter.new) expect_match_file(formatted, 'expected_no_routes.rbi') end end
Version data entries
39 entries across 39 versions & 1 rubygems