LoginSignup
0
0

Rpecの導入

Last updated at Posted at 2023-03-24

Gemfileに以下のコードを追加する

Gemfile
group :development, :test do
  # 〜 省略 〜
  gem 'rspec-rails' # この行を追加
  # 〜 省略 〜
end

bundleコマンドを実行してインストールする

ターミナル
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using erubi 1.12.0
Using racc 1.6.2
Using websocket-extensions 0.1.5
Using date 3.3.3
Using nio4r 2.5.8
Using bindex 0.8.1
Using crass 1.0.6
Using bundler 2.3.26
Using rack 2.2.6.4
Using msgpack 1.6.1
Using mini_mime 1.1.2
Using ast 2.4.2
Using method_source 1.0.0
Using timeout 0.3.2
Using marcel 1.0.2
Using io-console 0.6.0
Using json 2.6.3
Using builder 3.2.4
Using mysql2 0.5.5
Using parallel 1.22.1
Fetching diff-lcs 1.5.0
Using thor 1.2.1
Fetching rspec-support 3.12.0
Using rainbow 3.1.1
Using regexp_parser 2.7.0
Using rexml 3.2.5
Using ruby-progressbar 1.13.0
Using zeitwerk 2.6.7
Using unicode-display_width 2.4.2
Using i18n 1.12.0
Using tzinfo 2.0.6
Using nokogiri 1.14.2 (x86_64-darwin)
Using sprockets 4.2.0
Using net-protocol 0.2.1
Using reline 0.3.2
Using activesupport 7.0.4.3
Using loofah 2.19.1
Using parser 3.2.1.1
Using rails-dom-testing 2.0.3
Using bootsnap 1.16.0
Using rack-test 2.1.0
Using websocket-driver 0.7.5
Using net-smtp 0.3.3
Using globalid 1.1.0
Using irb 1.6.3
Using rails-html-sanitizer 1.5.0
Using net-pop 0.1.2
Using puma 5.6.5
Using actionview 7.0.4.3
Using net-imap 0.3.4
Using rubocop-ast 1.28.0
Using jbuilder 2.11.5
Using activemodel 7.0.4.3
Using debug 1.7.1
Using actionpack 7.0.4.3
Using activerecord 7.0.4.3
Using mail 2.8.1
Using sprockets-rails 3.4.2
Using activejob 7.0.4.3
Using railties 7.0.4.3
Using actioncable 7.0.4.3
Using activestorage 7.0.4.3
Using rubocop 1.48.1
Using actionmailer 7.0.4.3
Using rubocop-rails 2.18.0
Using actiontext 7.0.4.3
Using actionmailbox 7.0.4.3
Using web-console 4.2.0
Using rails 7.0.4.3
Installing rspec-support 3.12.0
Installing diff-lcs 1.5.0
Fetching rspec-core 3.12.1
Fetching rspec-expectations 3.12.2
Fetching rspec-mocks 3.12.4
Installing rspec-mocks 3.12.4
Installing rspec-expectations 3.12.2
Installing rspec-core 3.12.1
Fetching rspec-rails 6.0.1
Installing rspec-rails 6.0.1
Bundle complete! 12 Gemfile dependencies, 76 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Rspecの初期設定をする

ターミナル
$ bin/rails generate rspec:install
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
      create  spec/rails_helper.rb

参考サイト

0
0
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
0