@@ -360,7 +360,8 @@ def to_relationships(terms: nil, image: nil)
360360 value : '800' ,
361361 appraisal_date : '2006' ,
362362 notes : '17741786' ,
363- reserve_date : Date . new ( 2019 , 9 , 16 ) # '2019-09-16'
363+ reserve_date : Date . new ( 2019 , 9 , 16 ) , # '2019-09-16'
364+ suppressed : false
364365 }
365366 end
366367
@@ -400,6 +401,7 @@ def expected_errors_for(attributes, terms: valid_terms, image: valid_image, item
400401 relationships : valid_relationships
401402 }
402403 }
404+ # TODO: figure out how to test w/suppressed as JSON boolean rather than string
403405 expect { post items_url , params : payload , as : :jsonapi } . to change ( Item , :count ) . by ( 1 )
404406
405407 expect ( response ) . to have_http_status ( :created )
@@ -469,10 +471,11 @@ def expected_errors_for(attributes, terms: valid_terms, image: valid_image, item
469471 end
470472
471473 it 'accepts a suppressed item without an image' do
474+ expected_attributes = valid_attributes . merge ( suppressed : true )
472475 payload = {
473476 data : {
474477 type : 'item' ,
475- attributes : valid_attributes . merge ( suppressed : true ) ,
478+ attributes : expected_attributes ,
476479 relationships : to_relationships ( terms : valid_terms )
477480 }
478481 }
@@ -486,7 +489,7 @@ def expected_errors_for(attributes, terms: valid_terms, image: valid_image, item
486489
487490 item = Item . find ( item_id )
488491 expect ( item ) . not_to be_nil
489- valid_attributes . each { |attr , val | expect ( item . send ( attr ) ) . to eq ( val ) }
492+ expected_attributes . each { |attr , val | expect ( item . send ( attr ) ) . to eq ( val ) }
490493
491494 expect ( item . terms ) . to contain_exactly ( *valid_terms )
492495 expect ( item . image ) . to be_nil
0 commit comments