Ruby on rails 3 与“有问题”;参观;在rails集成测试教程中
我是rails的新手,现在正在跑步。我在运行集成测试时遇到问题。“访问”(Webrat?)方法似乎总是会失败。这是我从rspec得到的错误消息类型:Ruby on rails 3 与“有问题”;参观;在rails集成测试教程中,ruby-on-rails-3,integration-testing,webrat,Ruby On Rails 3,Integration Testing,Webrat,我是rails的新手,现在正在跑步。我在运行集成测试时遇到问题。“访问”(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
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模式:无
请确保您有指定模式的Webrat配置块
在test_helper.rb、spec_helper.rb或env.rb(用于Cucumber)中。
此配置块取代了需要“webrat/”的要求。
例如:
Webrat.configure do | config|
config.mode=:rails
结束
#./spec/requests/users_spec.rb:27:in'block(5层)in'
#./spec/requests/users_spec.rb:26:in'block(4层)in'
我尝试将上面的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)>'
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)>'
失败/错误:访问注册路径
没有要加载的文件--操作\u控制器/集成
#./spec/requests/users_spec.rb:27:in'block(5层)in'
#./spec/requests/users_spec.rb:26:in'block(4层)in'
我已经阅读了有关此问题的其他主题,他们建议使用“config.mode=:rack”,如果我这样做,则会出现以下错误:
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)>'
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)>'
失败/错误:访问注册路径
未定义的方法“最后的_响应”#
#./spec/requests/users_spec.rb:27:in'block(5层)in'
#./spec/requests/users_spec.rb:26:in'block(4层)in'
我想应该注意的是,我在win7x64上开始了教程,但我尝试在ubuntu上克隆存储库时也出现了同样的错误。如果有人想看一下,这里是存储库:
git://github.com/ender4/sample_app2.git
注意这里的2^
我读过很多类似的主题,但大多数解决方案都是针对rails/rspec/webrat的旧版本或其他测试框架(如cucumber),因此我不知道它们是否适用/如何适用
任何帮助都将不胜感激。我想我找到了罪犯,rspec 2.2.0。使用rspec 2.1.0似乎可以解决问题。将gems更新为:
group :development do
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
工作 如果您看到故障: