Skip to content

Singularize classes for feature names #1503

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
wants to merge 2 commits into from

Conversation

dysnomian
Copy link

This PR addresses issue #1403 by singularizing the class and table names in the feature generators.

@JonRowe
Copy link
Member

JonRowe commented Dec 10, 2015

Do we not have tests for the generators?

@fables-tales
Copy link
Member

@dysnomian thanks for the pull request! Could you make it so that the singularization only happens on an option, rather than the default? I'm also very surprised that none of our tests failed here. @cupakromer my best guess is that it's because we use rails g rspec:feature 'foos' everywhere in our generator tests. Is that correct?

@cupakromer
Copy link
Member

Yes, it looks like we simply have been passing plural options in our specs - so nothing failed. Clearly a gap in our specs testing that we "pluralized" stuff (>ლ). Also the change to the filename isn't covered by our specs either 😬

While this PR doesn't exactly singularize anything, it doesn't pluralize everything. 👍 If we can add a spec case for this that would be great.

In regards to the naming, I'm a little concerned that is a divergent change. The original use of table_name resulted in:

$ bin/rails g rspec:feature warehouse::widget
      create  spec/features/warehouse/warehouse_widgets_spec.rb

With this change we now will get:

$ bin/rails g rspec:feature warehouse::widget                
      create  spec/features/warehouse/warehouse::widget_spec.rb

@dysnomian
Copy link
Author

@samphippen, @cupakromer: Thanks for the feedback! Next steps:

  1. only singularize on a --singularize option
  2. update tests so that they pass and fail appropriately on:
  • text
    • spec filename
    • use class_name instead of table_name (that :: was a surprising case I hadn't considered! 😳 Good catch.)

Sound right?

@fables-tales
Copy link
Member

@dysnomian that sounds good to me.

@fables-tales
Copy link
Member

@dysnomian just wanted to check this was still something you're interested in working on? Let me know if you need any further help.

@dysnomian
Copy link
Author

@samphippen Yeah, still interested!

@dysnomian
Copy link
Author

Changes made. Any comments?

@fables-tales
Copy link
Member

This looks good. I'm going to locally add a changelog, and merge it down.

fables-tales pushed a commit that referenced this pull request Dec 19, 2015
@fables-tales
Copy link
Member

@dysnomian it is my intention to merge this via #1508 when that PR passes CI.

fables-tales pushed a commit that referenced this pull request Dec 19, 2015
@fables-tales
Copy link
Member

This was merged via #1508

sebjacobs pushed a commit to futurelearn/rspec-rails that referenced this pull request Mar 15, 2019
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.

4 participants