繁体   English   中英

Rspec 测试在嵌套引擎中使用活动 model 序列化程序未通过

[英]Rspec test that uses active model serializer in nested engine not passing

... serialized_animals = ActiveModel::Serializer::CollectionSerializer.new(animals, each_serializer: ApiHandler::Api::Private::MobileApp::V8::AnimalSerializer)
          aggregate_failures 'response details' do
            expect(JSON.parse(response.body)['data']['animals']).to(eq(JSON.parse(serialized_animals.to_json)))
          end ...

AnimalSerializer 位于 animal_engine/app/serializers/api_handler/api/private/mobile_app/v8

奇怪地序列化单个项目有效。

我收到以下错误

UncaughtThrowError:未捕获的抛出:no_serializer

使用:serializer 而不是:each_serializer。 不知道为什么它失败了,但它修复了它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM