2021-01-01から1年間の記事一覧
問題 RubyMine 内で RSpec を実行すると以下のエラーが出る。 You have already activated spring 2.1.1, but your Gemfile requires spring 2.1.0.~ しかし、ターミナルからRSpecを実行してもエラーは出ない。 解決 バンドラーをアップデートすると解決した…
これを 分割してない エディタで見るような感じでこうしたい。 分割した PR上にある設定マークから「split」を選ぶ。
ディレクトリを爆速で移動できるzコマンドを先輩に教えていただいた。 どんなものかというと、普通のcdコマンドならこう。 username ~ $ cd ~/dev/rails username ~/dev/rails zコマンドならたったこれだけで移動できる。 username ~ $ z rails username ~/d…
問題 $ brew update をしたら以下のエラーが出た。 Error: homebrew-core is a shallow clone. To `brew update` first run: git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow This restriction has been made on GitHu…
問題 everydayrails/everydayrails-rspec-2017: Sample source for the 2017 edition of Everyday Rails Testing with RSpec. サンプルコードをGitHubからクローンして、bundleコマンドを打つとこんなエラーが出る。 An error occurred while installing ffi…
rails_helper.rbにtravel_toを使う設定をする RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers end 例 it "3日後であること" do travel_to Date.new(2020, 1, 1) + 3.day do expect(Date.current).to eq '2020-01-04'.to_d…
直面したエラー rails sでサーバーを起動しようとしたら、こんなエラー画面が出てPostgreSQLが起動できない。 PG::ConnectionBad - could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP…
before_save とは オブジェクトがsaveされる前に発動されるコールバック 引数としてメソッドが渡された場合、それをクリアしないとsaveされない バリデーションの一種 Rails 4 での仕様 before_xxx では、false を返した場合のみ保存処理が停止していた nil …