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

Template variants on 4.0.0.beta2 with Rails 6.0.0.rc1 #2114

Closed
jaredmoody opened this issue Apr 30, 2019 · 7 comments

Comments

@jaredmoody
Copy link

commented Apr 30, 2019

The following spec passes on rspec-rails 3.8.2, rails 5.2.3, but errors on rspec-rails 4.0.0.beta2, rails 6.0.0.rc1:

# spec/views/layouts/sidebars/_main.html+app.haml_spec.rb
require 'rails_helper'

RSpec.describe 'layouts/sidebars/_main.html+app.haml', type: :view do
  it 'renders' do
    render
  end
end
Failures:

  1) layouts/sidebars/_main.html+app.haml renders
     Failure/Error: render

     ArgumentError:
       Invalid formats: :"html+app"
     # /Users/jaredmoody/.gem/ruby/2.5.5/gems/haml-5.0.4/lib/haml/helpers/action_view_mods.rb:14:in `render'
     # ./spec/views/layouts/sidebars/_main.html+app.haml_spec.rb:5:in `block (2 levels) in <top (required)>'

I was also able to duplicate this with an html+app.erb template so I don't think it's haml or haml-rails either.

@benoittgt

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

Hello

Do you think you can provide a reproduction case? I have started an app here https://github.com/benoittgt/testing_6_0_0_rc1 and invited you as a collaborator.

Thanks

@JonRowe

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

Can I ask if this works with Rails 5.2.3 and RSpec 6.0.0.rc1? Might this be a change at the Rails end?

@jaredmoody

This comment has been minimized.

Copy link
Author

commented Apr 30, 2019

Do you think you can provide a reproduction case? I have started an app here https://github.com/benoittgt/testing_6_0_0_rc1 and invited you as a collaborator.

Yes, I will add code there to reproduce.

Can I ask if this works with Rails 5.2.3 and RSpec 6.0.0.rc1? Might this be a change at the Rails end?

I think you have wrong gem versions here? Do you mean Rails 6.0.0.rc1 and some different version of rspec-rails?

@samphippen

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

@jhawthorn

This comment has been minimized.

Copy link

commented Apr 30, 2019

This is due to a change in Rails, specifically rails/rails#35661, but IMO the new behaviour is good. The issue is this filename parsing in rspec-rails doesn't actually support variants (and so it passes a format like html+app). I think it might also have weird behaviour if a format or handler isn't specified (ie. something.en.erb would be format: :en, handler: :erb).

I'm hoping to break this even more in future versions of Rails so I'm glad we're catching it now 🙂.

@benoittgt

This comment has been minimized.

Copy link
Member

commented Apr 30, 2019

Thanks a lot @jhawthorn

@samphippen

This comment has been minimized.

Copy link
Member

commented May 1, 2019

This is fixed in 4-0-dev

@samphippen samphippen closed this May 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.