Remove dir prefix from filename of tests under dir.
Created by: cirosantilli
Rename refactoring only commit. E.g.:
- rename
features/project/commits/commit_comments.feature
tocomments.feature
- rename
features/steps/project/project_wiki.rb
towiki.rb
- rename
features/steps/snippets/user_snippets.rb
touser.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_X
file 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.rb
already 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/basename
on 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.rb
orshared.rb
to be DRYer? - What if we rename all suffixes classes like
PublicProjects < Spinach::FeatureSteps
to prefix classes likeProjectsPublic
, which is already the case for the majority of tests? This would make this refactoring even neater.