Skip to content

Make so the test file name is formated in snakecase by generator#1765

Merged
kotp merged 2 commits into
mainfrom
fix-generator-test-file-name
Jul 26, 2025
Merged

Make so the test file name is formated in snakecase by generator#1765
kotp merged 2 commits into
mainfrom
fix-generator-test-file-name

Conversation

@meatball133
Copy link
Copy Markdown
Member

No description provided.

@meatball133 meatball133 added the x:rep/small Small amount of reputation label Jul 25, 2025
Copy link
Copy Markdown
Member

@kotp kotp left a comment

Choose a reason for hiding this comment

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

Suggested change.

How are we testing this? (I did not see the test file updated) Via rake test:generator to answer my own question.

Comment thread generatorv2/lib/generator.rb Outdated
end

def to_snake(str)
str.gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-", "_").downcase
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not...

Suggested change
str.gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-", "_").downcase
str.tr("-", "_").downcase

Are there tests for this file?

Comment thread generatorv2/lib/generator.rb Outdated
str.split(/[-_]/).map(&:capitalize).join
end

def to_snake(str)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see camel_case right above here, should this be snake_case instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also I see underscore is very similar. And the tests file has not been update to reflect testing of this new public method.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Didn't think about that method. Was quite tired when I made this commit, but good suggestion.

@kotp kotp merged commit 6a1face into main Jul 26, 2025
5 checks passed
@kotp kotp deleted the fix-generator-test-file-name branch July 26, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

x:rep/small Small amount of reputation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants