Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Merge requests
  • !6386

Merged
Created Feb 23, 2014 by Administrator@rootOwner

Remove dir prefix from filename of tests under dir.

  • Overview 3
  • Commits 1
  • Changes 59

Created by: cirosantilli

Rename refactoring only commit. E.g.:

  • rename features/project/commits/commit_comments.feature to comments.feature
  • rename features/steps/project/project_wiki.rb to wiki.rb
  • rename features/steps/snippets/user_snippets.rb to user.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 do pro<tab>X<tab>. This lets us do only X<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 as main.rb or shared.rb to be DRYer?
  • What if we rename all suffixes classes like PublicProjects < Spinach::FeatureSteps to prefix classes like ProjectsPublic, which is already the case for the majority of tests? This would make this refactoring even neater.
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: github/fork/booktree/rm-dir-prefix