我想确保我的清扫器被适当地调用,所以我尝试添加如下内容:
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
我尝试在测试配置中打开缓存,但这没有任何区别。