rake 规范失败,而 rake 规范:(models|controllers|views) 通过
我在 rspec 邮件列表上提出了这个问题,但没有得到回复,所以我想我应该在这里尝试一下。
在 ruby 1.9.2-p180 上使用 rspec 1.3.2 和 rspec-rails 1.3.4 以及 Rails 2.3.11,当我
$ rake spec:models
它们都通过时。当我
$ rake spec:controllers
他们都过去了。当我
$ rake spec:views
他们都过去了。但是当我
$ rake spec
得到
我一直在修改 rake 文件,当我更改时
t.spec_files = FileList['spec/**/*_spec.rb']
在默认任务中仅点击子目录之一,例如
t.spec_files = FileList['spec/models/**/*_spec.rb']
然后 rake 规范就可以工作了。我已经为模型、控制器和视图完成了此操作,并且 rake 规范对每个模型都工作得很好。但包括所有这些,例如
t.spec_files = FileList['spec/models/**/*_spec.rb', 'spec/controllers/**/*_spec.rb', 'spec/views/**/*_spec.rb']
确实不起作用(与上面提到的错误相同)。讽刺的是,仅包含模型和视图确实有效:
t.spec_files = FileList['spec/models/**/*_spec.rb', 'spec/views/**/*_spec.rb']
但似乎包括控制器在内的任何组合都会失败。这对我来说很奇怪,因为 rake spec:controllers 有效。除非它与文件和/或示例的数量有关。每种规范类型的文件和示例数量为
models: 25 files, 391 examples
controllers: 26 files, 973 examples
views: 52 files, 508 examples
仅使用 rake 规范确实可以在 Ruby 1.8.7(-p302) 和 Ruby 1.9.1(-p243) 上工作。
有人有什么想法吗?我可以单独运行每个组(甚至创建一个别名来一次完成所有操作),但 rspec 必须将应用程序启动 3 次。此外,这并没有解决为什么这在 ruby 1.9.2 上不起作用的原因。
I asked this question on the rspec mailing list but didn't get a response, so I thought I'd try here.
Using rspec 1.3.2 and rspec-rails 1.3.4 with rails 2.3.11 on ruby 1.9.2-p180, when I
$ rake spec:models
they all pass. When I
$ rake spec:controllers
they all pass. When I
$ rake spec:views
they all pass. But when I
$ rake spec
I get
<path to gem>/activesupport-2.3.11/lib/active_support/dependencies.rb:177: stack level too deep (SystemStackError)
I've been tinkering around with the rake file, and when I change
t.spec_files = FileList['spec/**/*_spec.rb']
in the default task to hit just one of the subdirectories, such as
t.spec_files = FileList['spec/models/**/*_spec.rb']
then rake spec works. I've done this for models, controllers, and views, and rake spec works fine for each. But including all of them like
t.spec_files = FileList['spec/models/**/*_spec.rb', 'spec/controllers/**/*_spec.rb', 'spec/views/**/*_spec.rb']
does not work (same error as mentioned above). Ironically, including just models and views does work:
t.spec_files = FileList['spec/models/**/*_spec.rb', 'spec/views/**/*_spec.rb']
but it seems that any combination including controllers will fail. This is odd to me since rake spec:controllers works. Unless it has something to do with the number of files and/or examples. The number of files and examples for each spec type is
models: 25 files, 391 examples
controllers: 26 files, 973 examples
views: 52 files, 508 examples
Using just rake spec did work on Ruby 1.8.7(-p302) and Ruby 1.9.1(-p243).
Does anyone have any ideas? I can run each group individually (and even create an alias to do it all at once), but then rspec has to spin up the app 3 times. Besides, that doesn't address why this isn't working on ruby 1.9.2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法解释为什么,但是当我
从 spec/spec.opts 中删除时,rake spec 再次起作用。它可能与这个线程[1]有关,但我不知道。
和平。
[1] http://www.ruby-forum.com/topic/1151108
I can't explain why, but when I remove
from spec/spec.opts, rake spec works again. It might have something to do with this thread [1], but I don't know.
Peace.
[1] http://www.ruby-forum.com/topic/1151108