Capybara 提交按钮 - 不兼容的编码正则表达式匹配
form.erb
<%= form_for @search do |f| %>
<%= f.text_field :name %>
<%= f.submit 'submit' %>
<% end %>
searchs_spec.rb
require 'spec_helper'
describe SearchesController do
it "should do something" do
visit searches_path
page.fill_in 'search_name', :with => 'oak'
click_button 'submit'
end
end
输出
Failure/Error: click_button 'submit'
Encoding::CompatibilityError:
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)
# ./spec/integration/searches_spec.rb:16:in `block (2 levels) in <top (required)>'
尝试简单地在水豚中提交表单,但收到此错误。有什么想法吗?
Rails 3.1、水豚 0.4.1.2、rspec-rails 2.5.0
form.erb
<%= form_for @search do |f| %>
<%= f.text_field :name %>
<%= f.submit 'submit' %>
<% end %>
searches_spec.rb
require 'spec_helper'
describe SearchesController do
it "should do something" do
visit searches_path
page.fill_in 'search_name', :with => 'oak'
click_button 'submit'
end
end
output
Failure/Error: click_button 'submit'
Encoding::CompatibilityError:
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)
# ./spec/integration/searches_spec.rb:16:in `block (2 levels) in <top (required)>'
Trying to simply submit a form in Capybara, but getting this error. Any ideas?
rails 3.1, capybara 0.4.1.2, rspec-rails 2.5.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 mculp 在评论中指出的,这确实是提到的 Rack 中的错误。
要暂时在本地修复它,请将以下内容放入 Cucumber 的 spec_helper.rb 或 env.rb 中(加载 Rack 后的任何位置)。
As mculp noted in the comments, this is indeed the mentioned bug in Rack.
To fix it locally for now, throw the following into your spec_helper.rb or env.rb for Cucumber (anywhere after Rack has been loaded.)