在ruby on rails测试中断言失败

时间:2014-04-28 21:19:05

标签: ruby-on-rails ruby testing

test_new方法的最后两个断言失败了,我不知道,因为被测试的控制器有效。

require File.dirname(__FILE__) + '/../../test_helper' 
require 'admin/supplier_controller' 

# Re-raise errors caught by the controller.   
class Admin::SupplierController; def rescue_action(e) raise e end; end  

class Admin::SupplierControllerTest < ActionController::TestCase
 fixtures :suppliers

 def setup   
     @controller = Admin::SupplierController.new  
     @request = ActionController::TestRequest.new  
     @response = ActionController::TestResponse.new  
 end  

def test_new
    get :new  
    assert_template 'admin/supplier/new'  
    assert_tag 'h1', :content => 'Create new supplier'  
    assert_tag 'form', :attributes => {:action => '/admin/supplier/create'}   
end  

end

0 个答案:

没有答案