我是rails的新手,正在运行
rails 3 tutorial.我在运行集成测试时遇到问题.似乎“访问”(Webrat?)方法总是会失败.这是我从rspec获得的一种错误消息:
Failure/Error: visit signup_path Unknown Webrat mode: nil Please ensure you have a Webrat configuration block that specifies a mode in your test_helper.rb,spec_helper.rb,or env.rb (for Cucumber). This configure block supercedes the need to require "webrat/<framework>". For example: Webrat.configure do |config| config.mode = :rails end # ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' # ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'
我尝试将上面的Webrat配置块添加到spec / spec_helpers.rb,我收到此错误:
Failure/Error: visit signup_path no such file to load -- action_controller/integration # ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' # ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'
我已经阅读了有关此问题的其他主题,他们建议使用’config.mode =:rack’,如果我这样做,那么我收到此错误:
Failure/Error: visit signup_path undefined method `last_response' for #<RSpec::Core::ExampleGroup::Nested_5::Nested_1::Nested_2:0xa4b8aac> # ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>' # ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'
我想重要的是要注意我在win7x64上启动了教程,但我尝试使用相同的错误克隆ubuntu上的存储库.如果有人想看看,这是存储库:
混帐://github.com/ender4/sample_app2.git
注意2那里^
我已经阅读了很多类似的主题,但大多数解决方案是针对旧版本的rails / rspec / webrat或其他测试框架(如黄瓜),所以我不知道它们是否适用于/如何应用.
任何帮助,将不胜感激.