0
0

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.

テストコード実装準備2(自分用)

Posted at

% rails g rspec:model user
% rails g rspec:model room
% rails g rspec:model message

などモデルごとに行う

例:spec/models/user_spec.rb

require 'rails_helper'

RSpec.describe User, type: :model do
describe '#create' do
before do
@user = FactoryBot.build(:user)
end

it 'nameとemail、passwordとpassword_confirmationが存在すれば登録できること' do

end

it 'nameが空では登録できないこと' do

end

it 'emailが空では登録できないこと' do

end

it 'passwordが空では登録できないこと' do

end

end
end

% bundle exec rspec spec/models/user_spec.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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?