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

"Jump to factory" link in tests #2417

Closed
1 task done
glaucocustodio opened this issue Aug 8, 2024 · 3 comments
Closed
1 task done

"Jump to factory" link in tests #2417

glaucocustodio opened this issue Aug 8, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@glaucocustodio
Copy link

I have checked that this feature is not already implemented

  • This feature does not exist

Use case

Would be nice to have a "Jump to factory" link in test files similar to the "Jump to view" we have in controllers.

describe "#foo" do
  it "calls foo" do
    # "Jump to factory" link  would appear here, once clicked would open the Widget factory
    widget = create(:widget)
    widget.foo
  end
end

Ps: considering one is using the factory_bot gem

Description

This would increase the productive of devs since they no longer will need to hit cmd+P to look for the factory file definition

Implementation

No response

@glaucocustodio glaucocustodio added the enhancement New feature or request label Aug 8, 2024
@st0012
Copy link
Member

st0012 commented Aug 8, 2024

Because this feature will require factory_bot-specific knowledge, which is not a Ruby default tool, it should be provided through an addon instead. We will not provide this feature directly from ruby-lsp.

You can either build a standalone addon gem like ruby-lsp-rspec, or convince factory_bot to have a built-in addon like standardrb does.

@st0012 st0012 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 8, 2024
@glaucocustodio
Copy link
Author

thank you for the references, that makes sense!

@andyw8
Copy link
Contributor

andyw8 commented Sep 20, 2024

I see @johansenja has released https://rubygems.org/gems/ruby-lsp-rails-factory-bot

(looks like the repo is missing/private though)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants