Skip to content

Commit

Permalink
Freezed 2T and 2B constants. Added new specs
Browse files Browse the repository at this point in the history
  • Loading branch information
luispcosta committed Mar 15, 2017
1 parent 24649d0 commit 6c3760b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/language_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ def self.find(code)
BY_NAME.freeze
BY_ISO_639_1.freeze
BY_ISO_639_3.freeze
BY_ISO_639_2B.freeze
BY_ISO_639_2T.freeze
end
8 changes: 8 additions & 0 deletions test/language_list_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,13 @@ def test_cannot_change_constants
assert_raises RuntimeError, /frozen Array/i do
LanguageList::BY_ISO_639_3[0] = nil
end

assert_raises RuntimeError, /frozen Array/i do
LanguageList::BY_ISO_639_2T[0] = nil
end

assert_raises RuntimeError, /frozen Array/i do
LanguageList::BY_ISO_639_2B[0] = nil
end
end
end

0 comments on commit 6c3760b

Please sign in to comment.