Skip to content

Commit

Permalink
Conditionally assert load_json returns symbolized data
Browse files Browse the repository at this point in the history
  • Loading branch information
paarthmadan committed Jan 26, 2022
1 parent be5a8e0 commit 5c4111e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/backend/simple_test.rb
Expand Up @@ -97,10 +97,12 @@ def setup

test "simple load_json: loads data from a JSON file" do
data, _ = I18n.backend.send(:load_json, "#{locales_dir}/en.json")
assert_equal({ :en => { :foo => { :bar => 'baz' } } }, data)

if JSON.respond_to?(:load_file)
assert_equal({ :en => { :foo => { :bar => 'baz' } } }, data)
assert_predicate data.dig(:en, :foo, :bar), :frozen?
else
assert_equal({ 'en' => { 'foo' => { 'bar' => 'baz' } } }, data)
end
end

Expand Down

0 comments on commit 5c4111e

Please sign in to comment.