Refactor #3994

Rename specs to have _spec.rb at the end

Added by Matt Robinson almost 2 years ago. Updated about 1 month ago.

Status:Closed Start date:06/11/2010
Priority:Low Due date:
Assignee:- % Done:

0%

Category:testing
Target version:2.6.0
Affected Puppet version:0.25.5 Branch:http://github.com/mmrobins/puppet/tree/bug/master/3994-rename_spec_files
Keywords:
Votes: 0

Description

I’d like to rename the spec files to have _spec.rb at the end. Most projects I’ve seen do this and I never really thought why, but I ran into a case today where the naming of the spec file messes up the spec run if you’re in the same directory as the spec.

in a puppet checkout: cd spec/unit/indirector spec rest.rb # spec/../lib/puppet/rails/param_value.rb:3: uninitialized constant ActiveRecord::Base (NameError)

This is happening because there’s a file in the same directory called active_record.rb (which is a spec for lib/puppet/indirector/rest.rb) that ends up being loaded instead of Rail’s active_record.

History

Updated by Matt Robinson almost 2 years ago

  • Status changed from Needs Decision to In Topic Branch Pending Review
  • Branch set to http://github.com/mmrobins/puppet/tree/bug/0.25.x/3994-rename_spec_files

The dev list is okay with this change, so I’ll mark this ready for testing. I’ve verified that this change doesn’t cause any test breakages, but I’m not sure if we have a process for people besides the original coder running tests.

Rather than cherry picking this into master for 0.26.x from 0.25.x (which where I based the branch off) it may be better to just do the rename there seperately. From the spec/unit directory run:

find . -name ‘.rb’ | xargs rename ’s/(.).rb/$1_spec.rb/'

Can verify afterwards that no files already had _spec at the end:

find . -name ‘*spec_spec.rb’

Updated by Matt Robinson almost 2 years ago

Rather than force someone else to do the rename in the 2.6 master branch per the instructions in my previous update, here’s a branch where' I’ve done that.

http://github.com/mmrobins/puppet/tree/bug/master/3994-rename_spec_files

Updated by Markus Roberts almost 2 years ago

  • Tracker changed from Bug to Refactor

Updated by Markus Roberts almost 2 years ago

  • Branch changed from http://github.com/mmrobins/puppet/tree/bug/0.25.x/3994-rename_spec_files to http://github.com/mmrobins/puppet/tree/bug/master/3994-rename_spec_files

We’re changging this on master, but not on 0.25.x

Updated by James Turnbull almost 2 years ago

  • Target version set to 2.6.0

Updated by Nick Lewis almost 2 years ago

Pushed to master in:

commit:51b70c05167399eb2274fc1add18b6b18d31429d commit:9a94ee274c39c261cd49e688a7bd7ea0eb73af50 commit:fdc8c3509b5ac5bc170c54d72b2c2bafb58409f2

Updated by Nick Lewis almost 2 years ago

  • Status changed from In Topic Branch Pending Review to Closed

Updated by Daniel Pittman about 1 month ago

  • Assignee deleted (Matt Robinson)

Also available in: Atom PDF