shakacode/react-webpack-rails-tutorial

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

patrickemuller opened this issue · 4 comments

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.

@patrickemuller did you solve this issue?

@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.

@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 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!