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

Version Path
sorbet-rails-0.7.34 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.33 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.32 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.31 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.27 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.26 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.25 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.24 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.23 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.22 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.20 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.19 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.18 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.5 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.4 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.3 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.2 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.1 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.7.0 spec/routes_rbi_formatter_spec.rb
sorbet-rails-0.6.5.1 spec/routes_rbi_formatter_spec.rb