0
ActiveModelSerializer에서 추가 된 객체의 속성 + 속성으로 응답하는 엔드 포인트가 있습니다. 응답에 키가 있는지 확인하는 테스트를 작성하려고합니다.API 응답에 RSpec 키가 있음을 테스트하는 방법
하자 가정 해 개체 (예를 들어 나무가) 내가 제대로이 테스트를 작성하려면 어떻게해야이 키
expected_tree_attributes = [:height, :age, :color]
subject { post :obtain_tree_info, { id: tree.id } }
response = JSON.parse(subject.body)
expected(response).to include(*expected_tree_attributes)
해당 사항 ... 허용할만한?