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

Choose other test framework when ruby-lsp-rails not present #1267

Conversation

tristil
Copy link

@tristil tristil commented Dec 22, 2023

Motivation

ruby-lsp chooses 'rails' framework when rails is present in the gem dependencies list, so that ruby-lsp-rails can add its own testing commands. But this can be confusing if somebody installs ruby-lsp without also installing ruby-lsp-rails on a rails project, because the test commands will not show up at all. Ideally a dialogue in the relevant extension would prompt the user to install ruby-lsp-rails, but ruby-lsp should select the available testing framework.

Implementation

If ruby-lsp-rails is not present look for minitest or test-unit instead.

Automated Tests

I updated the tests to handle the new case. There is one failing test that was preexisting.

Manual Tests

I tested this inside Vscode

@tristil tristil requested a review from a team as a code owner December 22, 2023 15:12
@tristil tristil requested review from Morriar and st0012 December 22, 2023 15:12
@tristil
Copy link
Author

tristil commented Dec 26, 2023

I have signed the CLA!

@andyw8
Copy link
Contributor

andyw8 commented Jan 9, 2024

Hi @tristil,

Am I correct in thinking that your Rails app uses "minitest style" tests?, e.g.:

def test_foo_is_true
  # ...
end

rather than ActiveSupport declarative tests, e.g.:

test "foo is true" do
 # ...
end

@tristil
Copy link
Author

tristil commented Jan 10, 2024

@andyw8 For the most part, yes

ruby-lsp chooses 'rails' framework when rails is present in the gem
dependencies list, so that ruby-lsp-rails can add its own testing
commands. But this can be confusing if somebody installs ruby-lsp
without also installing ruby-lsp-rails on a rails project, because the
test commands will not show up at all. Ideally a dialogue in the
relevant extension would prompt the user to install ruby-lsp-rails, but
ruby-lsp should select the available testing framework.
@tristil tristil force-pushed the choose_minitest_when_ruby_lsp_rails_not_present branch from 1df48e8 to 4853916 Compare January 12, 2024 21:23
@andyw8
Copy link
Contributor

andyw8 commented Feb 14, 2024

This should shortly be made unnecessary by #1381.

@andyw8 andyw8 closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants