<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mah666hhh</author_name>
  <author_url>https://blog.hatena.ne.jp/mah666hhh/</author_url>
  <blog_title>スリ飯屋MaLankaのフリーエンジニアな日々</blog_title>
  <blog_url>https://www.malanka.org/</blog_url>
  <categories>
    <anon>技術関連</anon>
    <anon>技術関連 - Rails</anon>
  </categories>
  <description>こんにちは、mah(@RailsRubyMah6h)です。 今回は、 RSpecでBase64エンコードされた画像ファイルをテストする です。 1、 テストに使う画像ファイルを、Base64でエンコードしたバイナリ文字列に変換する (下記のようなサイトを使うとラクです) https://lab.syncer.jp/Tool/Base64-encode/ 2、 1で得たバイナリ文字列から、spec/以下に画像ファイルを作る (ファイル名は適当に spec/assets/images/test_jpg.bin みたいにする。拡張子はバイナリを表すbin) 3、 RSpec内で、 File.read(spec/assets/images/test_jpg.bin) のようにすれば、 1の画像ファイルを読み込みでき、 Base64エンコードされたバイナリ文字列を取得できます。 あとは好きにテストで使いましょう。</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.malanka.org%2Fentry%2F2020%2F07%2F18%2F070000&quot; title=&quot;RSpecで、Base64エンコードされた画像ファイルをテストする - スリ飯屋MaLankaのフリーエンジニアな日々&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>https://cdn-ak.f.st-hatena.com/images/fotolife/m/mah666hhh/20200716/20200716085859.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-07-18 07:00:00</published>
  <title>RSpecで、Base64エンコードされた画像ファイルをテストする</title>
  <type>rich</type>
  <url>https://www.malanka.org/entry/2020/07/18/070000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
