I have been using autotest/zentest 3.5.0 with my rails 2.0.2 and rspec.
I
upgraded my gems and got 3.9.3 and had a problem. I went back to 3.5.0
and
it worked. I stayed there until moving to rails 2.1. I again updated my
gems
and got 3.10. This one had the same problem. This time I need to figure
out
what is wrong. Here is what I get:
/Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:394:in
find_files_to_test': undefined method
values’ for #Array:0x18b2530
(NoMethodError)
from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:239:in
run_tests' from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:228:in
get_to_green’
from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:208:in
run' from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:206:in
loop’
from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:206:in
run' from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/lib/autotest.rb:136:in
run’
from /Library/Ruby/Gems/1.8/gems/ZenTest-3.10.0/bin/autotest:55
from /usr/bin/autotest:19:in `load’
from /usr/bin/autotest:19
Here is the failing code:
def find_files
result = {}
targets = self.find_directories + self.extra_files
self.find_order.clear
targets.each do |target|
order = []
Find.find(target) do |f|
Find.prune if f =~ self.exceptions
next if test ?d, f
next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files
next if f =~ /\/\.?#/ # Emacs autosave/cvs merge
files
filename = f.sub(/^\.\//, '')
result[filename] = File.stat(filename).mtime rescue next
order << filename
end
self.find_order.push(*order.sort)
end
return result # this should return as a hash but is received as an
array
end
Find the files which have been modified, update the recorded
timestamps, and use this to update the files to test. Returns true
if any file is newer than the previously recorded most recent
file.
def find_files_to_test(files=find_files)
# for some reason files comes in as a array needs to be hash
#myfiles = {}
#files.each do |key, value|
#myfiles[key] = value
#end
#files = myfiles
updated = files.select { |filename, mtime| self.last_mtime < mtime }
p updated if $v unless updated.empty? or self.last_mtime.to_i == 0
updated.map { |f,m| test_files_for(f) }.flatten.uniq.each do
|filename|
self.files_to_test[filename] # creates key with default value
end
if updated.empty? then
nil
else
files.values.max <= line 394
end
end
For some reason the files is an array instead of a hash. I added the
little
change that is commented out and it works. But that should not have to
be
done.
Any ideas?
–
View this message in context:
http://www.nabble.com/autotest-failing-on-startup-tp18246365p18246365.html
Sent from the rspec-users mailing list archive at Nabble.com.