Skip to content

Instantly share code, notes, and snippets.

@juno
Created December 23, 2014 04:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juno/b8051132676f71c147a5 to your computer and use it in GitHub Desktop.
Save juno/b8051132676f71c147a5 to your computer and use it in GitHub Desktop.
Using rspec-mocks spy. http://journal.sooey.com/254
it 'Qnyp::Episodes::CalculateEpisodeRatingSummary.process を呼び出す' do
user = FactoryGirl.create(:user)
# Spyによる監視を行うためには、このようにオブジェクトやメソッドを監視するコードは必要
allow(Qnyp::Episodes::CalculateEpisodeRatingSummary).to receive(:process)
get :show
expect(Qnyp::Episodes::CalculateEpisodeRatingSummary)
.to have_received(:process)
.with(user)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment