File tree Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Expand file tree Collapse file tree 4 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 192
192
nio4r (2.5.8 )
193
193
nokogiri (1.14.2-aarch64-linux )
194
194
racc (~> 1.4 )
195
+ nokogiri (1.14.2-arm64-darwin )
196
+ racc (~> 1.4 )
195
197
nokogiri (1.14.2-x86_64-linux )
196
198
racc (~> 1.4 )
197
199
open-uri (0.3.0 )
340
342
341
343
PLATFORMS
342
344
aarch64-linux
345
+ arm64-darwin-22
343
346
x86_64-linux
344
347
345
348
DEPENDENCIES
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ class School < ApplicationRecord
4
+ validates :organisation_id , presence : true
5
+ validates :name , presence : true
6
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot . define do
4
+ factory :school do
5
+ organisation_id { SecureRandom . uuid }
6
+ sequence ( :name ) { |n | "School #{ n } " }
7
+ end
8
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails_helper'
4
+
5
+ RSpec . describe School do
6
+ describe 'validations' do
7
+ subject ( :school ) { build ( :school ) }
8
+
9
+ it 'has a valid default factory' do
10
+ expect ( school ) . to be_valid
11
+ end
12
+
13
+ it 'can save the default factory' do
14
+ expect { school . save! } . not_to raise_error
15
+ end
16
+
17
+ it 'is invalid if no organisation_id' do
18
+ school . organisation_id = ' '
19
+ expect ( school ) . to be_invalid
20
+ end
21
+
22
+ it 'is invalid if organisation_id is not a UUID' do
23
+ school . organisation_id = 'invalid'
24
+ expect ( school ) . to be_invalid
25
+ end
26
+
27
+ it 'is invalid if no name' do
28
+ school . name = ' '
29
+ expect ( school ) . to be_invalid
30
+ end
31
+ end
32
+ end
You can’t perform that action at this time.
0 commit comments