Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在rails 3.0.1中测试自定义路由不起作用,还是因为我?_Ruby_Ruby On Rails 3_Unit Testing_Testing_Functional Testing - Fatal编程技术网

Ruby 在rails 3.0.1中测试自定义路由不起作用,还是因为我?

Ruby 在rails 3.0.1中测试自定义路由不起作用,还是因为我?,ruby,ruby-on-rails-3,unit-testing,testing,functional-testing,Ruby,Ruby On Rails 3,Unit Testing,Testing,Functional Testing,出于某种原因,当我运行此功能测试时 require 'test_helper' class ListControllerTest < ActionController::TestCase test "should get mylist" do post :mylist, :format => :json assert_response :success end end list_controller.rb class ListController &l

出于某种原因,当我运行此功能测试时

require 'test_helper'

class ListControllerTest < ActionController::TestCase

  test "should get mylist" do
    post :mylist, :format => :json

    assert_response :success
  end
end
list_controller.rb

class ListController < ApplicationController
  def mylist
    respond_to do |format|
      format.json  { render :json => []}
    end
  end
end
有什么想法吗

问候,


迈克尔

好的。我得到了它。那些愚蠢的错误是最难发现的。有时候我哭着要ruby有很强的打字能力

问题出在routes.rb中。而不是:

match "/mylist" => "list#mylist", :method => "POST"
应该是的

match "/mylist" => "list#mylist", :via => :post

谢谢所有试图帮助我的人。

有路线吗?我们看不到您的路线文件。它作为指向gist的链接存在。将routes.rb直接添加到帖子中断言中的拼写错误是否也存在于实际代码中?什么拼写错误?我看不出有什么不对。请帮我指出来,乔,是打字错误。
match "/mylist" => "list#mylist", :method => "POST"
match "/mylist" => "list#mylist", :via => :post