Remove dir prefix from filename of tests under dir.
Created by: cirosantilli
Rename refactoring only commit. E.g.:
- rename
features/project/commits/commit_comments.featuretocomments.feature - rename
features/steps/project/project_wiki.rbtowiki.rb - rename
features/steps/snippets/user_snippets.rbtouser.rb
Advantages
- its DRYer: before we repeated the directory name in the files it contain.
- we type less: every time I want to select a
project_Xfile I have to dopro<tab>X<tab>. This lets us do onlyX<tab>instead. - it is more uniform: certain tests were already breaking the dir prefix "rule" before this commit, e.g.:
-
features/steps/project/deploy_keys.rbalready did not have the prefix before. - under steps, most files already don't contain the dir prefix. This removes it from the few that do.
-
Disadvantages
The only downside I can see is that if your editor only shows basenames on tabs, you can't tell some files apart. However:
- when working on a branch, it is likely that you will only touch files under a single directory.
- if you use a good editor (e.g. Vim) you can configure it to show
parent/basenameon tabs instead.
Therefore, I feel that the advantages outweight the disadvantages.
doubts
- Exception was made for files such as
project/project.rb, which are unchanged. What if we rename those asmain.rborshared.rbto be DRYer? - What if we rename all suffixes classes like
PublicProjects < Spinach::FeatureStepsto prefix classes likeProjectsPublic, which is already the case for the majority of tests? This would make this refactoring even neater.