@@ -306,14 +306,16 @@ def datatable_params(overrides = {})
306306 )
307307 get schools_path ( format : :json ) , params : datatable_params
308308 json = JSON . parse ( response . body )
309- entry = json [ "data" ] . find { |d | d [ "DT_RowId" ] == school . id . to_s }
309+ entry = json [ "data" ] . find { |d | d [ "DT_RowId" ] . to_i == school . id }
310310 expect ( entry ) . to be_present
311- expect ( entry [ "name" ] ) . to eq ( "Test Academy" )
312- expect ( entry [ "location" ] ) . to eq ( "Springfield, IL" )
311+ expect ( entry [ "name" ] ) . to include ( "Test Academy" )
312+ expect ( entry [ "name" ] ) . to include ( school_path ( school ) )
313+ expect ( entry [ "location" ] ) . to include ( "Springfield" )
313314 expect ( entry [ "country" ] ) . to eq ( "US" )
314- expect ( entry [ "website" ] ) . to eq ( "https://test.edu" )
315- expect ( entry [ "teachers_count" ] ) . to eq ( "0" )
316- expect ( entry [ "grade_level" ] ) . to eq ( "High School" )
315+ expect ( entry [ "website" ] ) . to include ( "https://test.edu" )
316+ expect ( entry [ "grade_level" ] ) . to include ( "High School" )
317+ expect ( entry [ "actions" ] ) . to include ( "Edit" )
318+ expect ( entry [ "actions" ] ) . to include ( edit_school_path ( school ) )
317319 end
318320
319321 it "filters by name" do
@@ -325,7 +327,7 @@ def datatable_params(overrides = {})
325327 get schools_path ( format : :json ) , params : datatable_params ( search : { value : "Unique Zebra" } )
326328 json = JSON . parse ( response . body )
327329 expect ( json [ "recordsFiltered" ] ) . to eq ( 1 )
328- expect ( json [ "data" ] . first [ "name" ] ) . to eq ( "Unique Zebra School" )
330+ expect ( json [ "data" ] . first [ "name" ] ) . to include ( "Unique Zebra School" )
329331 end
330332
331333 it "filters by state" do
@@ -337,7 +339,7 @@ def datatable_params(overrides = {})
337339 get schools_path ( format : :json ) , params : datatable_params ( search : { value : "AK" } )
338340 json = JSON . parse ( response . body )
339341 names = json [ "data" ] . map { |d | d [ "name" ] }
340- expect ( names ) . to include ( "Xylophone Academy" )
342+ expect ( names . any? { | n | n . include? ( "Xylophone Academy" ) } ) . to be true
341343 end
342344
343345 it "filters by city" do
@@ -348,7 +350,7 @@ def datatable_params(overrides = {})
348350 )
349351 get schools_path ( format : :json ) , params : datatable_params ( search : { value : "Wollongong" } )
350352 json = JSON . parse ( response . body )
351- expect ( json [ "data" ] . map { |d | d [ "name" ] } ) . to include ( "Quokka School" )
353+ expect ( json [ "data" ] . any? { |d | d [ "name" ] . include? ( "Quokka School" ) } ) . to be true
352354 end
353355
354356 it "filters by website" do
@@ -359,7 +361,7 @@ def datatable_params(overrides = {})
359361 )
360362 get schools_path ( format : :json ) , params : datatable_params ( search : { value : "narwhal-unique" } )
361363 json = JSON . parse ( response . body )
362- expect ( json [ "data" ] . map { |d | d [ "name" ] } ) . to include ( "Narwhal Institute" )
364+ expect ( json [ "data" ] . any? { |d | d [ "name" ] . include? ( "Narwhal Institute" ) } ) . to be true
363365 end
364366
365367 it "paginates results with start and length" do
0 commit comments