Bug #32616
openapipie-rails fails to write examples with encoding error
Description
@
$ APIPIE_RECORD=examples bundle exec rake test
expecting nil from test/graphql/queries/model_query_test.rb:51. This will fail in Minitest 6.
DEPRECATED: Use assert_nil if expecting nil from test/graphql/queries/model_query_test.rb:52. This will fail in Minitest 6.
DEPRECATED: Use assert_nil if expecting nil from test/graphql/queries/model_query_test.rb:53. This will fail in Minitest 6.
.........................................................................................................................................................................................................................................................................................................................
Finished in 2680.090524s, 3.0126 runs/s, 7.6307 assertions/s.
8074 runs, 20451 assertions, 9 failures, 19 errors, 4 skips
You have skipped tests. Run with --verbose for details.
Writing examples to a file
Traceback (most recent call last):
11: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor.rb:185:in `block in <top (required)>'
10: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor.rb:52:in `finish'
9: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor.rb:84:in `write_examples'
8: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor/writer.rb:78:in `write_examples'
7: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor/writer.rb:23:in `write_recorded_examples'
6: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/apipie-rails-0.5.18/lib/apipie/extractor/writer.rb:45:in `serialize_examples'
5: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/json-2.5.1/lib/json/common.rb:406:in `pretty_generate'
4: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/json-2.5.1/lib/json/common.rb:406:in `generate'
3: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/core_ext/object/json.rb:39:in `to_json'
2: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/core_ext/object/json.rb:39:in `to_json'
1: from /home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/core_ext/object/json.rb:39:in `to_json'
/home/vagrant/foreman/.vendor/ruby/2.5.0/gems/activesupport-6.0.3.7/lib/active_support/core_ext/object/json.rb:39:in `to_json': source sequence is illegal/malformed utf-8 (JSON::GeneratorError)
@
Its vagrant box and using UTF-8 encoding only,
$ echo $LC_ALL
en_US.UTF-8
No data to display