If you have a top-level test inside a test defined with describe Klass, the :close step will fail when ActiveSupport attempts to call to_json on a class object. The example group description args only goes up one level, so this error only happens when you have a test at the root of your top-level describe.
ie:
describe Model do
it "fails to marshal the description args"
describe "with inner group" do
it "passes"
end
end
For the first test, example.metadata[:example_group][:description_args] will be [Model(...active record description)], instead of a string representation.
This PR simply calls to_s on all example group description args to ensure we are not attempting to call to_json on a Ruby Class
If you have a top-level test inside a test defined with
describe Klass
, the:close
step will fail when ActiveSupport attempts to call to_json on a class object. The example group description args only goes up one level, so this error only happens when you have a test at the root of your top-level describe.ie:
For the first test,
example.metadata[:example_group][:description_args]
will be[Model(...active record description)]
, instead of a string representation.This PR simply calls to_s on all example group description args to ensure we are not attempting to call to_json on a Ruby Class