minitest路由测试htpp:200错误

时间:2013-03-11 12:05:58

标签: ruby-on-rails ruby testing minitest

我使用minitest进行测试框架。

**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

路由文件如上所述。我为上面的get和post进程设置了注册页面路由。当它发布时,它会重定向到" auth / identity / register"页。我将页面的发布地址设置为" 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

0 个答案:

没有答案