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

Fixed content_type comparison from eq to match #2484

Merged
merged 1 commit into from Mar 13, 2021

Conversation

ham0215
Copy link
Contributor

@ham0215 ham0215 commented Mar 12, 2021

Since Rails 6.1, the return value of content-type has changed as follows, so the scaffold template has been modified to support Rails6.1 and others.

https://github.com/rails/rails/pull/36034/files#diff-f5ff9aa07f44111a79d56c09ec37d774b462d97aff68f32490c2e56e74c95783R137

Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I guess this is unrelated to Rails' change since they claim that previously:

resp.content_type #=> "text/csv; header=present"

And we're actually already using match(a_string_including in a couple of places in the same file. We weren't using it consistently though.

PS

now returned

🤯

@JonRowe
Copy link
Member

JonRowe commented Mar 12, 2021

These are generator templates, so I'm happy for you to merge these as is if you want @pirj but I am curious why our tests didn't pick this up?

@pirj
Copy link
Member

pirj commented Mar 13, 2021

@JonRowe This is due to the generated spec containing this:

RSpec.describe "/<%= name.underscore.pluralize %>", <%= type_metatag(:request) %> do
  let(:valid_attributes) {
    skip("Add a hash of attributes valid for your model")
  }

So we're skipping them when running example_app_generator's app. It's something that we could improve.

@pirj pirj merged commit f24f278 into rspec:main Mar 13, 2021
@pirj
Copy link
Member

pirj commented Mar 13, 2021

Thank you, @ham0215 !

@JonRowe
Copy link
Member

JonRowe commented Mar 15, 2021

@pirj Ah a change broke the example app generator then, as we explicitly gsub that to a hash... but a multi line wouldn't match... we need to fix that here, and then ensure it can't break like this again... https://github.com/rspec/rspec-rails/blob/main/example_app_generator/generate_stuff.rb#L165

JonRowe added a commit that referenced this pull request Mar 17, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants