|
6 | 6 | module RubyLsp
|
7 | 7 | module Rails
|
8 | 8 | class HoverTest < ActiveSupport::TestCase
|
9 |
| - setup do |
10 |
| - body = File.read("#{__dir__}/../../test/fixtures/search_index.js") |
11 |
| - stub_request(:get, %r{https://api\.rubyonrails\.org/v.*/js/search_index\.js}) |
12 |
| - .with( |
13 |
| - headers: { |
14 |
| - "Host" => "api.rubyonrails.org", |
15 |
| - "User-Agent" => %r{^ruby-lsp-rails\/.*$}, |
16 |
| - }, |
17 |
| - ) |
18 |
| - .to_return(status: 200, body: body, headers: {}) |
19 |
| - |
20 |
| - # Build the Rails documents index ahead of time |
21 |
| - capture_io do |
22 |
| - Support::RailsDocumentClient.send(:search_index) |
23 |
| - end |
24 |
| - end |
25 |
| - |
26 | 9 | test "hook returns model column information" do
|
27 | 10 | expected_response = {
|
28 | 11 | schema_file: "#{dummy_root}/db/schema.rb",
|
@@ -201,45 +184,6 @@ class User < ApplicationRecord
|
201 | 184 | refute_match(/Schema/, response.contents.value)
|
202 | 185 | end
|
203 | 186 |
|
204 |
| - test "shows documentation for routes DSLs" do |
205 |
| - value = hover_on_source("root 'projects#index'", { line: 0, character: 0 }).contents.value |
206 |
| - |
207 |
| - assert_match(/\[Rails Document: `ActionDispatch::Routing::Mapper::Resources#root`\]/, value) |
208 |
| - assert_match(%r{\(https://api\.rubyonrails\.org/.*\.html#method-i-root\)}, value) |
209 |
| - end |
210 |
| - |
211 |
| - test "shows documentation for controller DSLs" do |
212 |
| - value = hover_on_source("before_action :foo", { line: 0, character: 0 }).contents.value |
213 |
| - |
214 |
| - assert_match(/\[Rails Document: `AbstractController::Callbacks::ClassMethods#before_action`\]/, value) |
215 |
| - assert_match(%r{\(https://api\.rubyonrails\.org/.*\.html#method-i-before_action\)}, value) |
216 |
| - end |
217 |
| - |
218 |
| - test "shows documentation for job DSLs" do |
219 |
| - value = hover_on_source("queue_as :default", { line: 0, character: 0 }).contents.value |
220 |
| - |
221 |
| - assert_match(/\[Rails Document: `ActiveJob::QueueName::ClassMethods#queue_as`\]/, value) |
222 |
| - assert_match(%r{\(https://api\.rubyonrails\.org/.*\.html#method-i-queue_as\)}, value) |
223 |
| - end |
224 |
| - |
225 |
| - test "shows documentation for model DSLs" do |
226 |
| - value = hover_on_source("validate :foo", { line: 0, character: 0 }).contents.value |
227 |
| - |
228 |
| - assert_match(/\[Rails Document: `ActiveModel::EachValidator#validate`\]/, value) |
229 |
| - assert_match(%r{\(https://api\.rubyonrails\.org/.*\.html#method-i-validate\)}, value) |
230 |
| - end |
231 |
| - |
232 |
| - test "shows documentation for Rails constants" do |
233 |
| - value = hover_on_source(<<~RUBY, { line: 2, character: 14 }).contents.value |
234 |
| - class ActiveRecord::Base |
235 |
| - end |
236 |
| - ActiveRecord::Base |
237 |
| - RUBY |
238 |
| - |
239 |
| - assert_match(/\[Rails Document: `ActiveRecord::Base`\]/, value) |
240 |
| - assert_match(%r{\(https://api\.rubyonrails\.org/.*Base\.html\)}, value) |
241 |
| - end |
242 |
| - |
243 | 187 | private
|
244 | 188 |
|
245 | 189 | def hover_on_source(source, position)
|
|
0 commit comments