2011-02-28 48 views
1

我手動創建了我的程序的所有路線,當然也使用我的rspec測試。通常,我的路線和測試工作正常,但我的角色控制器的測試有問題。路線如下:爲什麼Rails Rspec測試不起作用?

scope :path => '/characters', :controller => :characters do 
    get '/' => :show, :as => 'user_character' 
    end 

/字符在我的瀏覽器中測試時工作正常。一切似乎都很好。但是,測試:

require 'spec_helper' 
require 'devise/test_helpers' 

describe CharactersController do 
    login_user 

    describe "when it GETS 'show'" do 
     it "should render the template and be successful" do 
      get :show 
      response.should render_template(:show) 
      response.should be_success 
     end 
    end 

end 

與錯誤失敗:

1) CharactersController when it GETS 'show' should render the template and be successful 
    Failure/Error: get :show 
    ActionController::RoutingError: 
     No route matches {:controller=>"characters", :action=>"show"} 
    # ./spec/controllers/characters_controller_spec.rb:9 

我所有的控制器有做工精細的類似測試。爲什麼這不起作用?

重要編輯:

剛剛看到,如果我把叉勺關閉,測試通過!這是爲什麼發生?每次添加新測試時,Spork是否需要重新啓動?

回答

相關問題