
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
RSpec Mock Object Example
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
RSpec Mock Object Example
Here's an example of a simple mock I did for a controller test in a rails application: before(:ea... Here's an example of a simple mock I did for a controller test in a rails application: before(:each) do @page = mock_model(Page) @page.stub!(:path) @page.stub!(:find_by_id) @page_type = mock_model(PageType) @page_type.stub!(:name) @page.stub!(:page_type).and_return(@page_type) end In this case, I'm mocking the Page & PageType models (Objects) as well as stubbing out a few of the methods I call. Th