ITeye博客

在netbeans6.7中使用rspec1.2.7

rainlife · 2009-07-10 14:20 · Ruby On Rails · 编程语言 · Markdown

将开发工具换成了netbeans6.7,rspec的版本,也变成了1.2.7,使用的过程中,发现一直无法跑起来,幸好netbeans forum上面已经有人发现并解决了:

Just thought I'd let people know that rpsec-1.2.7 seems to have changed the way you get the line number from a spec file.

As a result, netbeans 6.7 won't run specs if you have 1.2.7 installed. The fix I've implemented (ymmv) is to change nb_rspec_mediator.rb. This lives in /usr/local/netbeans-6.7/ruby2/nb_rspec_mediator.rb on my linux machine.

Line 204 defines NbSpecParser, but it extends a class that no longer exists.

Change that line to:

class NbSpecParser < Spec::Runner::LineNumberQuery

and all should be well again :). You now won't be able to run with rspec < 1.2.7, so if that's required, you might need some conditional logic around the class definition. Anyway, I hope this helps someone.

解决也非常简单:将/netbeans-6.7/ruby2/nb_rspec_mediator.rb中的第204行换成 class NbSpecParser < Spec::Runner::LineNumberQuery 下面就按照rspec wiki上面的步骤操作:


ruby script/plugin install git://github.com/dchelimsky/rspec.git -r 'refs/tags/1.2.7'
ruby script/plugin install git://github.com/dchelimsky/rspec-rails.git -r 'refs/tags/1.2.7.1'
ruby script/generate rspec

接下来就可以在netbeans下使用rspec相应的generator了。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。