Skip to content

Need help with Docker + Capybara + RSpec + Hot Reload assets #465

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

Closed
patrickemuller opened this issue Jun 4, 2020 · 4 comments
Closed
Labels

Comments

@patrickemuller
Copy link

I'm been struggling to have Hot Reload working with Docker + Capybara + RSpec.

I can't use Hot Reload when testing views with Capybara, the Webpack serving the assets always says that I cannot access the build packs from one container to another, even when I configure Webpack options to allow requests from outside the container.

The only way I can have my specs working is when I do rake assets:precompile before running the specs. But using this way, I had to create a container just with RSpec options and ENV vars (so I tell rails to precompile instead of serving assets from Webpack).

Do you guys have faced a similar behavior before?
I'll try to attach some screenshots and code in the next days, just to show more information about what I'm facing right now.

@justin808
Copy link
Member

@patrickemuller did you solve this issue?

@patrickemuller
Copy link
Author

@patrickemuller did you solve this issue?

No, unfortunately, I was forced to precompile the assets and serve them as static for RSpec container.
No matter how I configure the security flags for Webpack container, I wasn't able to access the container path.

@justin808
Copy link
Member

@patrickemuller rspec should always use compiled assets. I've never ran the "precompile" task to do this. Then again, I don't understand why you'd use multiple docker containers.

@patrickemuller
Copy link
Author

@patrickemuller RSpec should always use compiled assets. I've never run the "precompile" task to do this. Then again, I don't understand why you'd use multiple docker containers.

I'm supporting a very old and legacy project and doing modifications along the way. And yes, I wasn't supposed to have more than 1 container to run Rails and RSpec. The only thing that keeps me from using the same container is because I need an entrypoint to run certain commands before running RSpec. The way they implemented the Webpack server and the way they're using React on Rails prevent me from using the RSpec in the correct way.

I'll close this issue for now, I've researched in the subject and more and more it feels that I should change the way the project does things instead of just do a simple hotfix.

Thank you guys, keep safe in these difficult times!

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

No branches or pull requests

2 participants