Unit Tests

Unit tests assert against behavior of an individual component within the application (often, an individual method or function).

These tests are fast and don't interact with the "outside world".

Example

require "rails_helper"

RSpec.describe Calculator do
  describe ".add" do
    it "adds positive integers" do
      expect(Calculator.add(1, 2)).to eq(3)
    end

    it "adds negative integers" do
      expect(Calculator.add(-1, -2)).to eq(-3)
    end
  end
end