<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yusukedoi</author_name>
  <author_url>https://blog.hatena.ne.jp/yusukedoi/</author_url>
  <blog_title>ESM アジャイル事業部 開発者ブログ</blog_title>
  <blog_url>https://blog.agile.esm.co.jp/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>RSpec</anon>
  </categories>
  <description>はじめに こんにちは。入社して4年目になりました、wai-doi です。 お仕事でRSpecでテストを書いていて、 「引数に特定の値が渡された時だけスタブしたい」 ということがありました。そのときどのように書けばよいか分からなかったので、今回は調べたこととその方法を書きます。 実行環境 Ruby 3.1.2 RSpec 3.11.0 サンプルコード 例えば以下の Shopper#buy_fruits メソッドのテストをしたいとします。単純に配列の ['apple', 'banana', 'orange'] を返します。 class Shopper def buy_fruits(shop) ba…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.agile.esm.co.jp%2Fentry%2Frspec-stub&quot; title=&quot;RSpecで引数に特定の値が渡された時だけスタブしたい - ESM アジャイル事業部 開発者ブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2022-06-23 12:30:00</published>
  <title>RSpecで引数に特定の値が渡された時だけスタブしたい</title>
  <type>rich</type>
  <url>https://blog.agile.esm.co.jp/entry/rspec-stub</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
