メモるブログ

技術メモを書いていく所存

2018-05-27

記事紹介

Do we need dependency injection in Ruby?

  • RubyのテストでDI使うかexpect, allow({expect, allow}_any_instance_of)使うかの話
  • DI使ったほうが依存関係を明示できて良い(カナリア的な意味合いも含めて)
  • Arrange Act Assertパターンで実装できる
  • デバッグしやすい、などなど

4 (of many) awesome additions in Ruby 2.5.1 (and how to install it)

  • Ruby 2.5.1の新機能について
  • Structのキーワード引数は良さそう(だけどあんまりStruct使ったこと無いな…ほとんどクラスにしちゃう

The simple but powerful Ruby Struct

  • Structの使い方、使い所。OpenStructの話とか
  • スタブ用途だとrspecのdouble使っちゃうなー

APISnapshot built using Elm and Ruby on Rails is open source

Capybara inconsistent click behavior and flickering tests

  • CapybaraでJS実行するとJSのイニシャライゼーションが終わる前に処理が走ってしまう可能性があるのでいろいろとワークアラウンドがある
  • Poltergeistの場合はtrigger()
  • Seleniumの場合はexecute_script("document.querySelector('#new-task').click()”)

How to replace jQuery with Vue.js in Ruby on Rails apps

  • vue.js on railsの話
  • 普通にsprockets使っているだけでwebpackは未使用

Zero downtime migration from Enum to Single Table Inheritance

1. 新カラム作成
2. 新カラムへのデータ移行とmodule include + before_saveでnew columnにつっこむ
3. 旧カラムのignored_columns化とロジック移動
4. 旧カラムdrop
  • とても参考になる
  • ignored_columnsいいなー