Skip to content

Commit f8cea5c

Browse files
committed
Dojo ID が連番であることを確認するテストを追加
1 parent 15ac43f commit f8cea5c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/models/dojo_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,20 @@
7373
Dojo::DOJO_INFO_YAML_PATH = orig_yaml
7474
end
7575
end
76+
77+
describe 'validate id sequence' do
78+
it 'has sequential ids except for allowed gaps' do
79+
allowed_missing_ids = [
80+
1, 29, 63, 80, 93, 95, 142,
81+
160, 161, 162, 163, 164, 166,
82+
167, 168, 170, 171, 213
83+
]
84+
85+
ids = Dojo.load_attributes_from_yaml.map { |d| d['id'] }
86+
max_id = ids.max
87+
missing_ids = (1..max_id).to_a - ids
88+
89+
expect(missing_ids).to match_array(allowed_missing_ids)
90+
end
91+
end
7692
end

0 commit comments

Comments
 (0)