Chào mừng bạn đến với repo này! Đây là hướng dẫn để cài đặt và chạy môi trường unit test sử dụng RSpec trong một dự án Ruby on Rails.
- Đã cài đặt Docker
Clone repo này về máy của bạn bằng lệnh sau:
git clone https://github.com/loctx-nals/ruby-on-rails_unit-test.git
cd ruby-on-rails_unit-testdocker-compose up --build
docker exec -it ruby-on-rails_unit-test_web_1 bashTạo, migrate và seed cơ sở dữ liệu:
rails db:create
rails db:migrate
rails db:seedSử dụng gem rspec-rails để viết unit test, thông tin chi tiết tại https://github.com/rspec/rspec-rails
Để chạy toàn bộ test suite:
rspecHoặc chạy một file test cụ thể:
rspec spec/path/to/your_test_file.rb- faker
- factory_bot
- simplecov
- ...