Skip to content

Commit

Permalink
Extract helper 'wait_for_rails_to_boot'
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Dec 12, 2024
1 parent 955dc27 commit 5e845b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/ruby_lsp_rails/code_lens_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def index

def generate_code_lens_for_source(source, file: "/fake.rb")
with_server(source, URI(file)) do |server, uri|
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@rails_runner_client).is_a?(NullClient)
wait_for_rails_to_boot

server.process_message(
id: 1,
Expand Down
2 changes: 1 addition & 1 deletion test/ruby_lsp_rails/definition_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def baz; end

def generate_definitions_for_source(source, position)
with_server(source) do |server, uri|
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@rails_runner_client).is_a?(NullClient)
wait_for_rails_to_boot

server.process_message(
id: 1,
Expand Down
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@ def pop_message(outgoing_queue, &block)
message = outgoing_queue.pop until block.call(message)
message
end

def wait_for_rails_to_boot
sleep(0.1) while RubyLsp::Addon.addons.first.instance_variable_get(:@rails_runner_client).is_a?(NullClient)
end
end
end

0 comments on commit 5e845b0

Please sign in to comment.