- Run rails new
rails new [name] --api -T
- Copy your Gemfile
- Copy your .gitignore
- Copy your .rubocop.yml
- Install Rspec
rails generate rspec:install
- Install Shoulda
# spec/rails_helper.rb Shoulda::Matchers.configure do |config| config.integrate do |with| with.test_framework :rspec with.library :rails end end
- Install Guard (1/2)
bundle exec guard init rspec
- Install Guard (2/2)
# Guardfile watch(rails.controller) do ... rspec.spec.call("requests/#{m[1]}")
- Install Simplecov
# At the very top of your `spec/spec_helper.rb` require 'simplecov' SimpleCov.start
- Install Factory Bot
# spec/rails_helper.rb, RSpec.configure do |config| ... config.include FactoryBot::Syntax::Methods
- Create FactoryBot Test
# spec/factories_spec.rb require 'rails_helper' describe 'ModelFactories' do FactoryBot.factories.map(&:name).each do |factory_name| describe "the #{factory_name} factory" do it 'is valid' do expect(FactoryBot.create(factory_name)).to be_valid end end end end
Last active
January 16, 2024 01:44
-
-
Save fernandollisboa/cc8e35ad295d4fed008b068e6e9fa6c3 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment