1

私は最初の 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"
4

1 に答える 1