Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract test helper method wait_for_rails_to_boot #545

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 6 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,11 @@ def pop_message(outgoing_queue, &block)
message = outgoing_queue.pop until block.call(message)
message
end

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