2012-08-24 15 views
0

邁克爾·哈特爾斯Ruby On Rails教程第9章。在我authentication_pages_specs.rb的「提交更新行動」導致的規範與錯誤崩潰「未定義的局部變量或方法'用戶」的#(NameError)」授權規範不適用於放入請求

require 'spec_helper' 

describe "Authentication" do 
    subject { page } 


    describe "authorization" do 

    describe "for non signed-in users" do 
     let(:user) { FactoryGirl.create(:user) } 

     describe "in the users controller" do 
     describe "visiting the edit page" do 
      before { visit edit_user_path(user)} 
      it { should have_selector('title', text: 'Sign in')} 
     end 

     describe "submitting to the update action" do 
      describe { put user_path(user)} #Error on this line 
      specify { response.should redirect_to(signin_path) } 
     end 
     end 
    end 

    end 

end 

請告訴我cauing規範崩潰?

謝謝

+0

對於初學者來說,只要看一眼,你有'{把user_path(用戶)}'的'describe'塊,它應該在'it'塊中。 – veritas1

+0

非常感謝您指出這一點! :)。它應該在一個之前的塊而不是它。 – Kris

回答

0

把之前阻止放部分解決了這個問題