ResetPassword Controller 作成アクションのすべてのロジックを処理する ResetPassword というサービス オブジェクトがあります。また、サービス オブジェクトは既にテスト済みです。サービス オブジェクトをモックする必要がありますか? テスト済みであり、実行中の仕様が削減されるため、そうする必要があると思います。これまでのコントローラーのテスト コードは以下のとおりです。このように書くべきかどうかはわかりません。
require 'spec_helper'
describe ResetPasswordController do
describe "POST create" do
context "when email matches a user" do
let(:user) { Fabricate(:user) }
it "calls password_reset on PasswordReset" do
ResetPassword.stub(:reset_password)
ResetPassword.any_instance.should_receive(:reset_password)
post :create, email: user.email
end
it "redirects to root path" do
post :create, email: user.email
expect(response).to redirect_to root_path
end
end
context "when email doesn't match a user" do
it "redirects to new"
it "displays a flash error"
end
end
end