Skip to content

Instantly share code, notes, and snippets.

@rrabinovitch
Last active January 12, 2023 22:56
Show Gist options
  • Save rrabinovitch/eab9e4bd4dc5838e2c389dcc75b78986 to your computer and use it in GitHub Desktop.
Save rrabinovitch/eab9e4bd4dc5838e2c389dcc75b78986 to your computer and use it in GitHub Desktop.
  • local repo creation: rails new sweater_weather -T -d postgresql --api
  • create GH repo - do not set up readme or any of the other files on GH, it'll cause a merge conflict
  • set GH repo to be remote origin of local repo
  • initial commit
  • bundle => bundle exec rake db:create
  • gems
    • :development, :test block:
      • pry
      • rspec-rails
      • capybara - not necessary for only backend app
      • launchy
      • factory_bot_rails
    • :development block
      • rubocop-rails
      • rails-erd
    • :test block
      • simplecov
      • shoulda-matchers
      • if making third party API calls that need to be mocked
        • webmock
        • vcr
    • outside blocks
      • fast_jsonapi
      • table_print
      • if making third party API calls
        • figaro
        • faraday
  • rspec setup: run rails g rspec:install
  • rails_helper.rb gem setup:
    • at end of rspec.configure block add:
      config.include FactoryBot::Syntax::Methods
      # factory bot configuration
      
      Shoulda::Matchers.configure do |config|
        config.integrate do |with|
          with.test_framework :rspec
          with.library :rails
        end
      end
      # shoulda matchers configuration
  • if figaro gem added: run figaro install
  • if webmock and vcr gems added
    • at beginning of RSpec.configure... block in spec_helper.rb, add: require 'webmock/rspec'
    • at end of RSpec.configure... block in rails_helper.rb, add:
      VCR.configure do |config|
        config.allow_http_connections_when_no_cassette = true
        config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
        config.hook_into :webmock
        config.filter_sensitive_data('<API_KEY>') { ENV['API_KEY'] }
        config.default_cassette_options = { re_record_interval: 7.days }
        config.configure_rspec_metadata!
      end
      
@rrabinovitch
Copy link
Author

rrabinovitch commented Dec 30, 2022

flag options for rails new command
(check version info in gist)

@rrabinovitch
Copy link
Author

optional:
Screen Shot 2023-01-12 at 3 56 30 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment