我正在编写我的第一个 RSpec 测试并遇到了一些问题。这就是我所拥有的。
require 'spec_helper'
feature "submit a search request" do
scenario "submits a search to the correct path" do
visit root_path
within("#search-form") do
fill_in 'search', :with => 'mysearch'
end
click_button 'search-submit'
current_url.should == search_url(:utf8 => '✓', :search => 'mysearch')
end
end
参数按字母顺序返回。如果我将 :search 的名称更改为以 'u' 之后的任何字母开头,它就会通过。这是错误消息
1) the map search submits a search request to the map controller
Failure/Error: current_url.should == search_url(:utf8=> '✓', :search => 'mysearch')
expected: "http://www.example.com/map?search=mysearch&utf8=%E2%9C%93"
got: "http://www.example.com/map?utf8=%E2%9C%93&search=mysearch"