rspec 如何与 Rails 3 配合进行集成测试?
我想要实现的是在rails3中使用webrat进行集成测试,就像Yehuda在http://pivotallabs.com/talks/76-extending-rails-3 分钟 34.
示例:
describe SomeApp
it "should show the index page"
visit "/"
body.should =~ /hello world/
end
end
有人知道如何做到这一点吗?
What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34.
an example:
describe SomeApp
it "should show the index page"
visit "/"
body.should =~ /hello world/
end
end
Does someone knows a way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否尝试过使用 rspec-rails: http://github.com/rspec/rspec-rails
这是新 RSpec 2.0 的存储库(自述文件中的安装说明),它将与 Rails 3 一起使用。
Have you tried using rspec-rails: http://github.com/rspec/rspec-rails
That is the repository (install instructions in the Readme) for the new RSpec 2.0 which will work with Rails 3.
thoughtbot 刚刚就此发布了一篇博客文章。
— RSpec 与 Capybara 的端到端集成测试测试
thoughtbot just published a blog post on this.
— RSpec integration tests with Capybara for end-to-end testing
显然,rSpec 2 中将支持 Rails 3。
Support for Rails 3 is coming in rSpec 2, apparently.
检查此链接现在非常简单,可以使用 rspec 和 rails3
http://github.com/rspec/rspec-rails 并且您不需要像在rails 2.xx中一样运行script/generate rspec_scaffold,现在你只需运行rails gscaffold,它将生成rspec文件
ceck this link now it is very simple tu use rspec with rails3
http://github.com/rspec/rspec-rails and you don't need to run script/generate rspec_scaffold like in rails 2.x.x, now you just run rails g scaffold and it will generate the rspec files