1
我正在寫我的第一個RSpec測試並運行到一點牆壁。這是我的。參數的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
參數按字母順序返回。如果我將「搜索」的名稱更改爲以「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"