summaryrefslogtreecommitdiff
path: root/spec/models/company_spec.rb
blob: 0d254a8b207e0ec1608e51da638a82b6c31d98e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Company, type: :model do
  let(:company) { create(:company) }

  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:short_name) }
  it { should validate_presence_of(:country) }
  it { should validate_uniqueness_of(:short_name).ignoring_case_sensitivity }
  it { should have_one_attached(:logo) }

  describe '#to_param' do
    it "returns the model's url param" do
      expect(company.to_param).to eq(company.short_name)
    end
  end
end