スイーパーが適切に呼び出されていることを確認したいので、次のようなものを追加してみました。
it "should clear the cache" do
@foo = Foo.new(@create_params)
Foo.should_receive(:new).with(@create_params).and_return(@foo)
FooSweeper.should_receive(:after_save).with(@foo)
post :create, @create_params
end
しかし、私はただ得ます:
<FooSweeper (class)> expected :after_save with (...) once, but received it 0 times
テスト構成でキャッシュをオンにしようとしましたが、違いはありませんでした。