File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,19 @@ load "rails/tasks/statistics.rake"
1010require "bundler/gem_tasks"
1111require "rake/testtask"
1212
13+ # Since `server.rb` runs within the host Rails application, we want to ensure
14+ # we don't accidentally depend on sorbet-runtime. `server_test` intentionally doesn't use `test_helper`.
15+ # We run `server_test` in a seperate Rake task.
1316Rake ::TestTask . new ( :test ) do |t |
1417 t . libs << "test"
1518 t . libs << "lib"
16- t . test_files = FileList [ "test/**/*_test.rb" ]
19+ t . test_files = FileList [ "test/**/*_test.rb" ] - [ "test/ruby_lsp_rails/server_test.rb" ]
1720end
1821
19- task default : [ :"db:setup" , :test ]
22+ Rake ::TestTask . new ( :server_test ) do |t |
23+ t . libs << "test"
24+ t . libs << "lib"
25+ t . test_files = [ "test/ruby_lsp_rails/server_test.rb" ]
26+ end
27+
28+ task default : [ :"db:setup" , :test , :server_test ]
Original file line number Diff line number Diff line change 1+ # typed: strict
2+ # frozen_string_literal: true
3+
4+ module RubyLsp
5+ module Rails
6+ class Server
7+ # We need this since RBS doesn't yet have a replacement for T.unsafe()
8+ def print_it! ; end
9+ end
10+ end
11+ end
Original file line number Diff line number Diff line change 11# typed: true
22# frozen_string_literal: true
33
4- require "test_helper"
4+ # Configure Rails Environment
5+ ENV [ "RAILS_ENV" ] = "test"
6+ require_relative "../dummy/config/environment"
7+
8+ require "minitest/autorun"
9+ require "mocha/minitest"
510require "ruby_lsp/ruby_lsp_rails/server"
611
12+ if defined? ( T )
13+ puts "T is defined, indicating that sorbet-runtime was loaded"
14+ puts "This test should run without sorbet-runtime"
15+ exit ( 1 )
16+ end
17+
718class ServerTest < ActiveSupport ::TestCase
819 setup do
920 @stdout = StringIO . new
@@ -246,7 +257,7 @@ def print_it!
246257 end
247258 end
248259
249- T . unsafe ( server ) . print_it!
260+ server . print_it!
250261
251262 assert_match ( "Content-Length: 70\r \n \r \n " , stderr . string )
252263 assert_match (
You can’t perform that action at this time.
0 commit comments