emolog

脳内メモです。

rspecのセットアップ

github.com

# Or, run against the main branch
# (requires main-branch versions of all related RSpec libraries)
group :development, :test do
  %w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
    gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'main'
  end
end
# Download and install
$ bundle install

# Generate boilerplate configuration files
# (check the comments in each generated file for more information)
$ rails generate rspec:install
      create  .rspec
      create  spec
      create  spec/spec_helper.rb
      create  spec/rails_helper.rb
$ bundle exec rspec
No examples found.


Finished in 0.00047 seconds (files took 0.13557 seconds to load)
0 examples, 0 failures

実行できる

テストをみやすいように以下を追加

.rspec

# 出力結果を色分け
--color
# rails_helperの読み込み
--require rails_helper
# 出力結果をドキュメント風に見やすくする
--format documentation