7
私はRails 3.1.3を継承リソース1.3.0のプロジェクトに使用しています。Rails 3.1.3と継承されたリソーステストは失敗します
私はそうのようなコントローラがある場合:
class PostsController < InheritedResources::Base
end
を私は
describe "PUT update" do
describe "with invalid params" do
it "re-renders the 'edit' template" do
post = Post.create! valid_attributes
# Trigger the behavior that occurs when invalid params are submitted
Post.any_instance.stub(:save).and_return(false)
put :update, {:id => post.to_param, :post => {}}, valid_session
response.should render_template("edit")
end
end
end
次RSpecのをテストし、私は次のエラーを取得する:
3) PostsController PUT update with invalid params re-renders the 'edit' template
Failure/Error: response.should render_template("edit")
expecting <"edit"> but rendering with <"">
# ./spec/controllers/posts_controller_spec.rb:115:in `block (4 levels) in <top (required)>'
これはなぜでしょうか?私は他の何かをスタブする必要がありますか?