Skip to content

Commit

Permalink
Add test to check for manually gen'd ID (#4315)
Browse files Browse the repository at this point in the history
And prevent the reuse of deleted IDs
  • Loading branch information
lildude authored Nov 8, 2018
1 parent ee29c92 commit 58ef727
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test_language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ def test_all_languages_have_a_language_id_set
end

def test_all_languages_have_a_valid_id
invalid = Language.all.select { |language| language.language_id < 0 || language.language_id >= (2**31 - 1) }
deleted_language_ids = [21] # Prevent re-use of deleted language IDs
invalid = Language.all.select { |language| language.language_id < 0 || deleted_language_ids.include?(language.language_id) || (language.language_id > 431 && language.language_id < 1024) || language.language_id >= (2**31 - 1) }

message = "The following languages do not have a valid language_id. Please run `script/update-ids` as per the contribution guidelines.\n"
invalid.each { |language| message << "#{language.name}\n" }
Expand Down

0 comments on commit 58ef727

Please sign in to comment.