<?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>Tips</anon>
    <anon>Rails</anon>
    <anon>RSpec</anon>
  </categories>
  <description>ただのモックの書き方だが具体例を添えて。 環境 rails (5.2.0) rspec (3.7.0) やり方 allowとand_returnを使う allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new(&quot;production&quot;)) 原理 allow({{クラス名}}).to receive({{メソッド名}}).and_return({{代替死体戻り値}}) の形式で戻り値の振る舞いを変えることができる Rails.env における戻り値の型はただのStringではなく ActiveSuppor…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinkufencer.hateblo.jp%2Fentry%2F2018%2F09%2F27%2F235855&quot; title=&quot;RSpec内にてRails.envによって振る舞いの変わるものをテストしたい場合の書き方 - コード日進月歩&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-09-27 23:58:55</published>
  <title>RSpec内にてRails.envによって振る舞いの変わるものをテストしたい場合の書き方</title>
  <type>rich</type>
  <url>https://shinkufencer.hateblo.jp/entry/2018/09/27/235855</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
