This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 130844 - Go To Test does not work in non-Rails projects
Summary: Go To Test does not work in non-Rails projects
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Testing (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-22 16:22 UTC by Martin Krauskopf
Modified: 2008-03-27 12:04 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Krauskopf 2008-03-22 16:22:29 UTC
Not sure why GoToTest#findMatchingFile does not use FileOwnerQuery, thus it works only on Rails project. I think Tor did
that - any reason like performance? (but it should not matter in this case)

Particularly this structure does not work:

project_root/lib/subdir/my_class.rb
project_root/test/subdir/my_class_spec.rb

Also s/test/spec.
Comment 1 Erno Mononen 2008-03-26 17:10:26 UTC
Seems that using FileOwnerQuery fixes this for the most part, need to also check the patterns for RSpec tests.
Comment 2 Erno Mononen 2008-03-27 09:38:10 UTC
Fixed, changeset 1a4667652f9b. I couldn't find definitive info on where RSpec tests should be located in a plain Ruby 
project, I made the assumption that they should be in spec/ similarly as in Rails projects. If that's correct, then the 
spec/ folder should probably be displayed in the logical of the Ruby project.
Comment 3 Martin Krauskopf 2008-03-27 09:42:49 UTC
> spec/ folder should probably be displayed in the logical of the Ruby project.

You might add it as a source-root. But likely should be done automatically.

BTW I do not see the any commit, i.e. changeset 1a4667652f9b, should I reopen?
Comment 4 Erno Mononen 2008-03-27 09:56:01 UTC
Here's the commit, didn't notice that the first push failed:
http://hg.netbeans.org/main/rev/1a4667652f9b
Comment 5 Martin Krauskopf 2008-03-27 11:05:25 UTC
Looking at the commit, it seems that it does not handles other source roots then 'lib'. If anybody would add e.g.
'stdlib' as a source root, it will not work. Should I reopen this one or file a new one?

But for the 'lib' it works flawlessly, thanks.
Comment 6 Martin Krauskopf 2008-03-27 11:09:53 UTC
BTW if you try to checkout Rubinius sources you might see that they usually do not use mapping-by-names between specs
and source files. Not sure if this is usual. But might be we should somehow enhance the algorithm, probably source-code
based. 
Also Rubinius sources might be good testing project for RSpec, it is known to use RSpec heavily.
Comment 7 Erno Mononen 2008-03-27 11:47:01 UTC
Good point. It is a more general problem though, the source roots are hardcoded in the patterns (applies to Rails 
project as well), so probably best to file a new issue on that.
Comment 8 Erno Mononen 2008-03-27 12:04:16 UTC
Filed issue 131280.