<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shinkufencer</author_name>
  <author_url>https://blog.hatena.ne.jp/shinkufencer/</author_url>
  <blog_title>コード日進月歩</blog_title>
  <blog_url>https://shinkufencer.hateblo.jp/</blog_url>
  <categories>
    <anon>Rails</anon>
    <anon>Tips</anon>
  </categories>
  <description>前回の応用編。 環境 webmock (3.4.2) 実例 想定する用件 &quot;https://example.com/hogehoge&quot; というURLのに { &quot;id&quot;: 100 } のようなJSONを作り、idが100だったら成功するが、0を指定すると500エラーで落ちる。みたいなAPIを想定した場合 実際の設定 以下のように withで条件を設定して、そのときに出てくるレスポンスとしておいておくとよい #成功時 stub_request(:post, &quot;https://example.com/hogehoge&quot;). with( body: &quot;{\&quot;id\&quot;:100}&quot;,). to_retur…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinkufencer.hateblo.jp%2Fentry%2F2018%2F12%2F11%2F233000&quot; title=&quot;WebMockでパラメータによって成功時のリクエストと失敗時のレスポンスのモックを分ける - コード日進月歩&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>2018-12-11 23:30:00</published>
  <title>WebMockでパラメータによって成功時のリクエストと失敗時のレスポンスのモックを分ける</title>
  <type>rich</type>
  <url>https://shinkufencer.hateblo.jp/entry/2018/12/11/233000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
