Railsのテスト
RailsはRSpecを使用して、テストを自動化します。
RSpecのインストール
Section titled “RSpecのインストール”gem install rspecテストの作成
Section titled “テストの作成”require 'rails_helper'
RSpec.describe Book, type: :model do it 'is valid with valid attributes' do book = Book.new(title: 'Sample Book', author: 'Author Name') expect(book).to be_valid endendRSpec.describe: テスト対象を指定expect: 期待する結果を定義