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