0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

すぐに始められるRspecの環境構築のメモ(everydayrails用)

Last updated at Posted at 2021-05-26

はじめに

今回はeverudayrailsの2章(Rspecのセットアップ)が終了している状態のものから始めることにする。

開発環境

Mac os 11.2.3
ruby 2.7.1
シェル zsh

git clone

適当なディレクトリで

git clone  https://github.com/JunichiIto/everydayrails-rspec-2017.git

これですでにリポジトリがoriginに登録されていてmasterブランチにいるので

リモートブランチを以下のように自分のブランチに持ってくる。

git checkout -b my-03-models origin/02-setup

これで始めたい章のソースコードになっている。

続いてrails 6に対応させる。

まずはGemfile.lockの一番下のBUNDLED WITHを変更する。おそらく1.14.4くらいのバージョンになっているので新しいバージョンに書き換える(事前に新しいバージョンのbundlerのインストールが必要。)

BUNDLED WITH
   2.1.4

とする。
次にGemfileのrails,rspec-railsのみをを編集

gem 'rails', '~> 6.1', '>= 6.1.3.1'
gem 'rspec-rails', '~> 5.0'

この状態で

bundle update

を行うとおそらく下記エラーが出る

An error occurred while installing mimemagic (0.3.10), and Bundler cannot continue.
Make sure that `gem install mimemagic -v '0.3.10' --source 'https://rubygems.org/'` succeeds before bundling.

これを解消するために下記を実行

brew install shared-mime-info

次に

bundle update

次に下記を順に実行

rails db:create

rails db:migrate

rails s
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?