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

:identifiers in Rails 6 seem to fall into the wrong subscriber. #73

Open
ragaskar opened this issue Jan 21, 2022 · 4 comments
Open

:identifiers in Rails 6 seem to fall into the wrong subscriber. #73

ragaskar opened this issue Jan 21, 2022 · 4 comments

Comments

@ragaskar
Copy link

I have a bit of code that is render-ing a template like so:

render file: Rails.root.join('public', 'webpack_assets', 'index.html'), layout: false

This was previously being tested (with Rails 5) with an

assert_template(file: Rails.root.join('public', 'webpack_assets', 'index.html'))

This no longer works in Rails 6.1.1.4 (the assert_template actual is '[]' instead of the value of Rails.root.join('public', 'webpack_assets', 'index.html')). It seems like the payload containing the :identifier key falls into the subscription for render_template.action_view where it appears to be expected in the !render_template.action_view subscription.

Hopefully this makes sense, sorry for not providing more details, haven't gotten a chance to dig in more yet. If I get a moment I'll validate the change in Rails and propose a fix.

@airdrummingfool
Copy link

airdrummingfool commented Mar 2, 2022

I'm running into a similar problem. The template renders fine in normal use, but there is an error thrown when testing with render_template:

     Failure/Error: expect(response).to render_template(file: "#{Rails.root}/public/404.html")
       Expected [] to include "/app/public/404.html".

Render code:

  def render_not_found
    respond_to do |format|
      format.html { render file: 'public/404.html', status: :not_found, layout: false }
      format.json { render json: { code: 404, error: 'not found' }, status: :not_found }
    end
  end

@ragaskar did you ever find a workaround or a fix for this?

@airdrummingfool
Copy link

airdrummingfool commented Mar 3, 2022

I dug in a little bit and found that PR #46 has some discussion and a proposed fix: tconst@7c8f078. I rebased it onto the newest commit in airdrummingfool@d5c05e7.

@rafaelfranca
Copy link
Member

@airdrummingfool can you open a PR for that?

@airdrummingfool
Copy link

@rafaelfranca sure, done. See #76.

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

No branches or pull requests

3 participants