File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ class RunnerClientTest < ActiveSupport::TestCase
16
16
assert_predicate @client , :stopped?
17
17
end
18
18
19
+ # This is an integration test which starts the server. For the more fine-grained tests, see `server_test.rb`.
19
20
test "#model returns information for the requested model" do
20
21
# These columns are from the schema in the dummy app: test/dummy/db/schema.rb
21
22
columns = [
@@ -30,18 +31,6 @@ class RunnerClientTest < ActiveSupport::TestCase
30
31
assert_equal ( columns , response . fetch ( :columns ) )
31
32
assert_match ( %r{db/schema\. rb$} , response . fetch ( :schema_file ) )
32
33
end
33
-
34
- test "returns nil if model doesn't exist" do
35
- assert_nil @client . model ( "Foo" )
36
- end
37
-
38
- test "returns nil if class is not a model" do
39
- assert_nil @client . model ( "Time" )
40
- end
41
-
42
- test "returns nil if class is an abstract model" do
43
- assert_nil @client . model ( "ApplicationRecord" )
44
- end
45
34
end
46
35
end
47
36
end
Original file line number Diff line number Diff line change 5
5
require "ruby_lsp/ruby_lsp_rails/server"
6
6
7
7
class ServerTest < ActiveSupport ::TestCase
8
+ test "returns nil if model doesn't exist" do
9
+ response = RubyLsp ::Rails ::Server . new . resolve_database_info_from_model ( "Foo" )
10
+ assert_nil ( response . fetch ( :result ) )
11
+ end
12
+
13
+ test "returns nil if class is not a model" do
14
+ response = RubyLsp ::Rails ::Server . new . resolve_database_info_from_model ( "Time" )
15
+ assert_nil ( response . fetch ( :result ) )
16
+ end
17
+
18
+ test "returns nil if class is an abstract model" do
19
+ response = RubyLsp ::Rails ::Server . new . resolve_database_info_from_model ( "ApplicationRecord" )
20
+ assert_nil ( response . fetch ( :result ) )
21
+ end
8
22
test "handles older Rails version which don't have `schema_dump_path`" do
9
23
ActiveRecord ::Tasks ::DatabaseTasks . send ( :alias_method , :old_schema_dump_path , :schema_dump_path )
10
24
ActiveRecord ::Tasks ::DatabaseTasks . undef_method ( :schema_dump_path )
You can’t perform that action at this time.
0 commit comments