2
작성자가 많습니다. 저작물은 저작자에게 속합니다. RSpecing : 중첩 리소스에 대한 작업 업데이트
resources :authors do
resources :works
end
그리고 RSpec에
:it "should redirect to :show" do
work = FactoryGirl.create(:work)
controller.stub(:resource) { work }
work.should_receive(:update_attributes) { true }
put :update, id: work.id, author_id: work.author.id, work: {}
response.should redirect_to(admin_author_work_path(work.author, work))
end
그리고 오류 :
Expected response to be a redirect to <http://test.host/admin/authors/353/works/166>
but was a redirect to <http://test.host/admin/authors/353/works>
이 왜 works_controller의 리디렉션하지 않습니다 show 액션을? 내가 놓친 게 있니?
저는 inherit-resources와 controller.stub (: resource)를 사용하고 있습니다.
나는 또한 assign(:work, work) throws undefined method 'assign'
에 주목했습니다. 뷰에서 작동합니다. 컨트롤러에서도 작동하지 않아야합니까?