rspec 如何与 Rails 3 配合进行集成测试?

发布于 2024-08-19 05:54:46 字数 389 浏览 3 评论 0原文

我想要实现的是在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

像极了他 2024-08-26 05:54:46

您是否尝试过使用 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.

给我一枪 2024-08-26 05:54:46

thoughtbot 刚刚就此发布了一篇博客文章。

随着 Web 应用程序的发展和壮大,稳定性可能会成为一个问题 - 集成测试提供了一种执行端到端测试的好方法,以验证应用程序是否按预期执行。

RSpec 与 Capybara 的端到端集成测试测试

thoughtbot just published a blog post on this.

Stability can become an issue as web applications evolve and grow — integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected.

RSpec integration tests with Capybara for end-to-end testing

我一直都在从未离去 2024-08-26 05:54:46

显然,rSpec 2 中将支持 Rails 3。

Support for Rails 3 is coming in rSpec 2, apparently.

与酒说心事 2024-08-26 05:54:46

检查此链接现在非常简单,可以使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文