テストフレームワークにミニテストを使用します。
**routes.rb file**
Cultiva::Application.routes.draw do
root :to => 'welcome#index'
match "sign-up" => "identities#new", :as => :signup, method: :get
match "sign-up" => redirect("auth/identity/register"), :as => :signup, method: :post
match "sign-off" => "session#destroy", :as => :signoff
resources :identities
ルートファイルは上記のようなものです。上記のように、取得プロセスと事後プロセスのサインアップページルートを設定します。投稿すると、「認証/識別/登録」ページにリダイレクトされます。ページの投稿アドレスを「auth/Identity/register」に設定しました。私はテストの下で回転しました:
it "must route to auth/identity/register when method is post" do
post(signup_path).must_equal "/auth/identity/register"
end
when i run this test, it gives error:
test_0002_must route to auth/identity/register when method is post(Route Integration Test::signup_path) [/home/developer/Projects/Bilsa/cultiva/test/routes/route_test.rb:13]:
Expected: "/auth/identity/register"
Actual: 200