简体   繁体   English

rspec如何与Rails 3一起进行集成测试?

[英]How does rspec work with Rails 3 for integration tests?

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. 我正在尝试的方法是在rails3中使用webrat进行集成测试,就像Yehuda在http://pivotallabs.com/talks/76-extending-rails-3分钟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? 有人知道这样做的方法吗?

Have you tried using rspec-rails: http://github.com/rspec/rspec-rails 您是否尝试过使用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. 这是新的RSpec 2.0的存储库(自述文件中的安装说明),它将与Rails 3一起使用。

thoughtbot just published a blog post on this. thinkbot刚刚发布了一篇博文。

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

RSpec integration tests with Capybara for end-to-end testing - 与Capybara进行RSpec集成测试以进行端到端测试

RSPpec 2显然支持Rails 3。

现在,使用rails3 http://github.com/rspec/rspec-rails非常简单地使用rspec,你不需要像rails 2.xx一样运行脚本/生成rspec_scaffold ,现在你只需运行rails g脚手架 ,它将生成rspec文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM