before(:all) で allow ( stub ) は実行できない
describe "" do before(:all) do allow(object).to receive(:hoge).and_return(‘fuga’) end it {} end
こんな風に書くと、ダメです。Rspec では、 before(:all) での stub や mock はサポートされていない為、以下のような例外が出力されます。
RSpec::Mocks::OutsideOfExampleError: The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported.
例外で終了しているのですが、結果はテストが全て通ったように錯覚してしまうことがあるので、気をつける