aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/organisation_spec.rb
blob: 1aad0a01b356c37bd93bf88a4b7c7e1a9d58a485 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'rails_helper'

RSpec.describe Organisation, type: :model do

  subject = Organisation.new(name: "Hollander Property")

  describe "validations" do
    it "is invalid if no name given" do
      subject.name = nil
      expect(subject).to_not be_valid
    end

    it "is invalid with a name longer than 25 chars" do
      subject.name = "a" * 26
      expect(subject).to_not be_valid
    end

    it "is valid with a name shorter than 25 characters" do
      subject.name = "Crifford Ltd"
      expect(subject).to be_valid
    end
  end
end