[PATCH] Removal of spec command in autotest introduces problems
Reported by John-Mason P. Shackelford | August 22nd, 2008 @ 11:39 PM | in Maintenance
I'm not to the bottom of this yet, but I wanted to send a warning flag early that the following commit breaks autotest/rspc on Windows for me:
http://github.com/jpshackelford/...
I am running latest GitHub version.
Comments and changes to this ticket
-
John-Mason P. Shackelford November 3rd, 2008 @ 11:11 PM
See also a comment on the mail list to the same effect:
-
John-Mason P. Shackelford November 3rd, 2008 @ 11:52 PM
Confirming that this is a problem in rspec 1.1.11. Adding the following code to my .autotest file addresses the issue, but IMHO we should fix this in the gem.
class Autotest::Rspec < Autotest def make_test_cmd(files_to_test)return '' if files_to_test.empty? return "#{ruby} -S spec #{files_to_test.keys.flatten.join(' ')} #{add_options_if_present}"end end
-
John-Mason P. Shackelford November 3rd, 2008 @ 11:55 PM
Formatted properly: (from 1.1.14)
class Autotest::Rspec < Autotest
def make_test_cmd(files_to_test) return '' if files_to_test.empty? return "#{ruby} -S spec #{files_to_test.keys.flatten.join(' ')} #{add_options_if_present}" endend
-
raggi November 5th, 2008 @ 03:02 PM
- → Tag changed from autotest bug to autotest bug command line loader spec
Yup, confirm this causes yet more problems than just the windows one.
In fact, I'd recommend revising out the 'magic loader'.
Observe:
ln -s spec/0_spec.rb /dev/null
Now you won't get spec runs.
Why?
ruby -S spec/0_spec.rb [...] will not load the rspec gem.
[...] will not be loaded, as it's just ARG[V|F].
This can happen in other ways, too, like commented out links to spec helper and whatnot, and can be really hard to debug, as ruby just exits with no error code, and no output, because nothing happened.
The expected result would be that the particular spec file should just be skipped.
The problem is vendor environments.
speconly exists in the path for gem installs.Key points: * ruby's -S flag is not appropriate in the current setup * the current setup incorrectly magically loads ARGF * the current setup requires the first file to load rspec * on failure, there is no output at all * spec location discovery required to put
specback in, sensible to use full path and skip -SIf I have time I'll create a patch today.
-
-
raggi November 5th, 2008 @ 09:14 PM
- → Title changed from Removal of spec command in autotest breaks windows to Removal of spec command in autotest introduces problems
And here's that patch I mentioned. Also available for pull here:
http://github.com/raggi/rspec/co...
Cheers folks :-)
-
raggi November 10th, 2008 @ 05:31 PM
- → Tag changed from autotest bug command line loader spec to autotest bug command line loader patch spec
- → Title changed from Removal of spec command in autotest introduces problems to [PATCH] Removal of spec command in autotest introduces problems
Adding patch leader in name.
-
David Chelimsky November 28th, 2008 @ 05:22 PM
- → Milestone changed from No-Milestone-Assigned to Maintenance
- → State changed from new to resolved
- → Assigned user changed from to David Chelimsky
Patch applied: http://github.com/dchelimsky/rsp...
-
Frank Luke December 2nd, 2008 @ 06:46 PM
I noticed that autotest and rake:spec were giving different numbers of test completed (I tested this because autotest was not picking up changes to the file I was working on). I downloaded the patch above, installed it, and reran. The same tests were skipped even with the full list being output (instead of -S).
Both rake:spec and autotest are skipping some files but not the same ones. Autotest is skipping all 3 views for a certain class (line_of_coverage). Rake:spec skips a routing_spec file for another class (master_plan_design). Both have 3 words and underscores. Don't know if that matters.
-
raggi December 3rd, 2008 @ 01:49 PM
David - thanks :-)
Frank:
Can you paste the commands that are being invoked by autotest and by rake spec. I can't replicate what you're talking about here, based on the information provided.
Also, rails or not?
-
Frank Luke December 3rd, 2008 @ 05:25 PM
Raggi,
Thanks for responding. Yes to Rails.
Rake:spec generates this command: c:/ruby/bin/ruby -I"c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/lib" "c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec" "spec/controllers/access_control_spec.rb" "spec/controllers/authenticated_system_spec.rb" "spec/controllers/carriers_controller_spec.rb" "spec/controllers/carriers_routing_spec.rb" "spec/controllers/dependencies_controller_spec.rb" "spec/controllers/dependencies_routing_spec.rb" "spec/controllers/employers_controller_spec.rb" "spec/controllers/employers_routing_spec.rb" "spec/controllers/employments_controller_spec.rb" "spec/controllers/employments_routing_spec.rb" "spec/controllers/employment_classes_controller_spec.rb" "spec/controllers/employment_classes_routing_spec.rb" "spec/controllers/home_controller_spec.rb" "spec/controllers/lines_of_coverage_controller_spec.rb" "spec/controllers/lines_of_coverage_routing_spec.rb" "spec/controllers/master_plan_designs_controller_spec.rb" "spec/controllers/people_controller_spec.rb" "spec/controllers/people_routing_spec.rb" "spec/controllers/rights_controller_spec.rb" "spec/controllers/rights_routing_spec.rb" "spec/controllers/roles_controller_spec.rb" "spec/controllers/roles_routing_spec.rb" "spec/controllers/sessions_controller_spec.rb" "spec/controllers/sessions_routing_spec.rb" "spec/controllers/users_controller_spec.rb" "spec/controllers/users_routing_spec.rb" "spec/helpers/admin_helper_spec.rb" "spec/helpers/application_helper_spec.rb" "spec/helpers/carriers_helper_spec.rb" "spec/helpers/dependencies_helper_spec.rb" "spec/helpers/employers_helper_spec.rb" "spec/helpers/employments_helper_spec.rb" "spec/helpers/home_helper_spec.rb" "spec/helpers/lines_of_coverage_helper_spec.rb" "spec/helpers/master_plan_design_helper_spec.rb" "spec/helpers/people_helper_spec.rb" "spec/helpers/rights_helper_spec.rb" "spec/helpers/roles_helper_spec.rb" "spec/lib/menu_system_spec.rb" "spec/models/carrier_spec.rb" "spec/models/dependency_spec.rb" "spec/models/employer_spec.rb" "spec/models/employment_class_spec.rb" "spec/models/employment_spec.rb" "spec/models/line_of_coverage_spec.rb" "spec/models/master_plan_design_spec.rb" "spec/models/person_spec.rb" "spec/models/plan_design_spec.rb" "spec/models/right_spec.rb" "spec/models/role_spec.rb" "spec/models/user_spec.rb" "spec/models/user_stamp_support_spec.rb" "spec/views/admin/index.html.erb_spec.rb" "spec/views/admin/rights/edit.html.erb_spec.rb" "spec/views/admin/rights/index.html.erb_spec.rb" "spec/views/admin/rights/new.html.erb_spec.rb" "spec/views/admin/rights/show.html.erb_spec.rb" "spec/views/admin/roles/edit.html.erb_spec.rb" "spec/views/admin/roles/index.html.erb_spec.rb" "spec/views/admin/roles/new.html.erb_spec.rb" "spec/views/admin/roles/show.html.erb_spec.rb" "spec/views/admin/users/edit.html.erb_spec.rb" "spec/views/admin/users/index.html.erb_spec.rb" "spec/views/admin/users/new.html.erb_spec.rb" "spec/views/admin/users/show.html.erb_spec.rb" "spec/views/carriers/edit.html.erb_spec.rb" "spec/views/carriers/index.html.erb_spec.rb" "spec/views/carriers/master_plan_designs/edit.html.erb_spec.rb" "spec/views/carriers/master_plan_designs/show.html.erb_spec.rb" "spec/views/carriers/new.html.erb_spec.rb" "spec/views/carriers/show.html.erb_spec.rb" "spec/views/employers/edit.html.erb_spec.rb" "spec/views/employers/employments/edit.html.erb_spec.rb" "spec/views/employers/employments/show.html.erb_spec.rb" "spec/views/employers/index.html.erb_spec.rb" "spec/views/employers/new.html.erb_spec.rb" "spec/views/employers/show.html.erb_spec.rb" "spec/views/lines_of_coverage/edit.html.erb_spec.rb" "spec/views/lines_of_coverage/index.html.erb_spec.rb" "spec/views/lines_of_coverage/new.html.erb_spec.rb" "spec/views/people/dependencies/edit.html.erb_spec.rb" "spec/views/people/dependencies/show.html.erb_spec.rb" "spec/views/people/edit.html.erb_spec.rb" "spec/views/people/index.html.erb_spec.rb" "spec/views/people/new.html.erb_spec.rb" "spec/views/people/show.html.erb_spec.rb" "spec/views/sessions/new.html.erb_spec.rb" --options "C:/Active/ISEBA/app/iseba/spec/spec.opts"
Autotest generates: c:\ruby\bin\ruby c:/ruby/lib/ruby/gems/1.8/gems/rspec-1.1.11/bin/spec spec/views/admin/users/index.html.erb_spec.rb spec/models/carrier_spec.rb spec/controllers/employers_controller_spec.rb spec/controllers/lines_of_coverage_routing_spec.rb spec/views/admin/roles/edit.html.erb_spec.rb spec/lib/menu_system_spec.rb spec/views/admin/users/edit.html.erb_spec.rb spec/views/admin/roles/show.html.erb_spec.rb spec/controllers/authenticated_system_spec.rb spec/models/user_stamp_support_spec.rb spec/helpers/roles_helper_spec.rb spec/views/people/new.html.erb_spec.rb spec/controllers/users_controller_spec.rb spec/controllers/dependencies_controller_spec.rb spec/helpers/employments_helper_spec.rb spec/views/admin/users/show.html.erb_spec.rb spec/views/sessions/new.html.erb_spec.rb spec/views/admin/rights/index.html.erb_spec.rb spec/helpers/rights_helper_spec.rb spec/views/employers/employments/show.html.erb_spec.rb spec/views/admin/rights/show.html.erb_spec.rb spec/views/employers/employments/edit.html.erb_spec.rb spec/models/employment_spec.rb spec/controllers/employment_classes_routing_spec.rb spec/controllers/carriers_routing_spec.rb spec/views/employers/show.html.erb_spec.rb spec/models/master_plan_design_spec.rb spec/views/people/edit.html.erb_spec.rb spec/views/employers/edit.html.erb_spec.rb spec/helpers/employers_helper_spec.rb spec/views/people/index.html.erb_spec.rb spec/models/user_spec.rb spec/helpers/lines_of_coverage_helper_spec.rb spec/controllers/access_control_spec.rb spec/controllers/roles_routing_spec.rb spec/views/carriers/edit.html.erb_spec.rb spec/helpers/admin_helper_spec.rb spec/models/person_spec.rb spec/controllers/rights_routing_spec.rb spec/views/admin/rights/new.html.erb_spec.rb spec/views/people/dependencies/edit.html.erb_spec.rb spec/views/admin/roles/index.html.erb_spec.rb spec/controllers/employments_routing_spec.rb spec/controllers/dependencies_routing_spec.rb spec/helpers/people_helper_spec.rb spec/views/people/dependencies/show.html.erb_spec.rb spec/views/carriers/index.html.erb_spec.rb spec/models/plan_design_spec.rb spec/views/employers/new.html.erb_spec.rb spec/models/right_spec.rb spec/models/line_of_coverage_spec.rb spec/views/people/show.html.erb_spec.rb spec/controllers/people_controller_spec.rb spec/views/admin/index.html.erb_spec.rb spec/controllers/lines_of_coverage_controller_spec.rb spec/models/dependency_spec.rb spec/controllers/master_plan_designs_routing_spec.rb.rb spec/views/carriers/master_plan_designs/show.html.erb_spec.rb spec/helpers/master_plan_design_helper_spec.rb spec/models/employer_spec.rb spec/views/carriers/master_plan_designs/edit.html.erb_spec.rb spec/controllers/sessions_routing_spec.rb spec/views/employers/index.html.erb_spec.rb spec/controllers/roles_controller_spec.rb spec/helpers/dependencies_helper_spec.rb spec/helpers/home_helper_spec.rb spec/controllers/users_routing_spec.rb spec/views/admin/users/new.html.erb_spec.rb spec/controllers/people_routing_spec.rb spec/views/admin/roles/new.html.erb_spec.rb spec/views/carriers/show.html.erb_spec.rb spec/controllers/home_controller_spec.rb spec/controllers/master_plan_designs_controller_spec.rb spec/controllers/carriers_controller_spec.rb spec/views/admin/rights/edit.html.erb_spec.rb spec/models/role_spec.rb spec/controllers/rights_controller_spec.rb spec/controllers/employments_controller_spec.rb spec/helpers/application_helper_spec.rb spec/models/employment_class_spec.rb spec/controllers/sessions_controller_spec.rb spec/controllers/employment_classes_controller_spec.rb spec/views/carriers/new.html.erb_spec.rb spec/helpers/carriers_helper_spec.rb spec/controllers/employers_routing_spec.rb -O spec/spec.opts
-
Frank Luke December 3rd, 2008 @ 05:31 PM
If you paste those sets into a spreadsheet and sort the files, you find that autotest does not test the spec/views/lines_of_coverage/ directory. And rake:spec gets those but skips master_plan_designs_routing_spec.rb.
My spec.opts is: --colour --format progress --loadby mtime --reverse
My .autotest is: Autotest.add_hook :initialize do |at| %w{.autotest .svn eee.rb$ nbproject rake vendor .html$ .css$ README spec/spec.opts spec/rcov.opts}.each {|pattern| at.add_exception(pattern)} end
-
raggi December 3rd, 2008 @ 05:32 PM
Rake is missing:
["spec/views/lines_of_coverage/edit.html.erb_spec.rb", "spec/views/lines_of_coverage/index.html.erb_spec.rb", "spec/views/lines_of_coverage/new.html.erb_spec.rb"]
Autotest is missing:
["spec/controllers/master_plan_designs_routing_spec.rb.rb"]
N.B. the .rb.rb
Not sure what's wrong with the rake run off the top of my head.
-
Frank Luke December 3rd, 2008 @ 05:37 PM
Raggi,
Reverse those. Autotest skips the views for loc and rake skips the master_plan_designs_routing_spec.
Thanks for the quick reply.
-
-
Frank Luke December 10th, 2008 @ 08:05 PM
Fixed the rake:spec not picking up files. I had accidentally named master_plan_designs_routing_spec.rb.rb. The second extension seems to have thrown the test runner. Now I just need to find out why autotest is skipping some view specs.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
