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
Allow preview controller to be customized via config options #493
Allow preview controller to be customized via config options #493
Conversation
|
I'm up for trying to add tests case if desired. I tried for a bit but was having problems:
Open to ideas / feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can do something like this https://github.com/github/view_component/blob/master/test/test_helper.rb#L24 to test this feature?
Co-authored-by: Juan Manuel Ramallo <juanmanuelramallo@hey.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how @joelhawksley would like to proceed. IMHO we can extract the failing test out of this PR so that we can find a good way to test it.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey I think I found the issue why the test helper method you added wasn't working. For some reason this variable https://github.com/github/view_component/pull/493/files#diff-28535a42af4bc1dff3bc550d0e400775R91 always contains "view_components". So I tried moving that inside the route definition block, and it worked as expected.
It might be related to the fact that the rails app has already been initialized hence the variable remains the same.
However, when we place that variable inside the route definition block (I mean here https://github.com/github/view_component/pull/493/files#diff-28535a42af4bc1dff3bc550d0e400775R93) and the test helper reloads the app that block is re-run. Ending up in the result we expect.
Does this make sense?
|
@juanmanuelramallo Wow! That was tricky, I don't think I would ever have thought to test that, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
|
@swanson This looks great! Can you add a changelog entry for this improvement? once that's complete, @juanmanuelramallo would you like to merge this PR? |
|
@BlakeWilliams sure thing! Is there anything in particular I should have in mind? (it'd be my first time merging a PR here) |
|
@juanmanuelramallo I generally follow the steps listed here, https://github.com/github/view_component/blob/master/CONTRIBUTING.md#submitting-a-pull-request Things like ensuring that folks add themselves as a contributor, changelog entries if applicable, etc. |
|
Noted, thanks! |
|
Hey @swanson sorry for the back and forth, but would you mind adding yourself in the list of contributors at the bottom of the readme? Step 6 in this guide https://github.com/github/view_component/blob/master/CONTRIBUTING.md#submitting-a-pull-request and don't forget about the first part of step 8 🙈 |
|
@juanmanuelramallo no problem, done! |
|
Thank you @swanson! |
Resolves #434
Summary
Adds a
preview_base_controllerconfiguration option to allow users to override the base controller used for previews.