@@ -258,27 +258,27 @@ def dynamo_request(table_name, scan_hash = {}, select_opts = {})
258258 end
259259
260260 it 'performs query on a table with a range and selects items in a range' do
261- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_between : [ 0.0 , 3.0 ] ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] ]
261+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_between : [ 0.0 , 3.0 ] ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] , { last_evaluated_key : nil } ] ]
262262 end
263263
264264 it 'performs query on a table with a range and selects items in a range with :select option' do
265- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_between : [ 0.0 , 3.0 ] , select : 'ALL_ATTRIBUTES' ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] ]
265+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_between : [ 0.0 , 3.0 ] , select : 'ALL_ATTRIBUTES' ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] , { last_evaluated_key : nil } ] ]
266266 end
267267
268268 it 'performs query on a table with a range and selects items greater than' do
269- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_greater_than : 1.0 ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 3 ) } ] ]
269+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_greater_than : 1.0 ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 3 ) } ] , { last_evaluated_key : nil } ] ]
270270 end
271271
272272 it 'performs query on a table with a range and selects items less than' do
273- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_less_than : 2.0 ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 1 ) } ] ]
273+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_less_than : 2.0 ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 1 ) } ] , { last_evaluated_key : nil } ] ]
274274 end
275275
276276 it 'performs query on a table with a range and selects items gte' do
277- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_gte : 1.0 ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] ]
277+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_gte : 1.0 ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] , { last_evaluated_key : nil } ] ]
278278 end
279279
280280 it 'performs query on a table with a range and selects items lte' do
281- expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_lte : 3.0 ) . to_a ) . to eq [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] ]
281+ expect ( Dynamoid . adapter . query ( test_table3 , hash_value : '1' , range_lte : 3.0 ) . to_a ) . to eq [ [ [ { id : '1' , range : BigDecimal ( 1 ) } , { id : '1' , range : BigDecimal ( 3 ) } ] , { last_evaluated_key : nil } ] ]
282282 end
283283
284284 it 'performs query on a table and returns items based on returns correct limit' do
@@ -677,11 +677,14 @@ def dynamo_request(table_name, scan_hash = {}, select_opts = {})
677677 ] )
678678
679679 results = Dynamoid . adapter . scan ( test_table3 )
680- expect ( results . to_a . first ) . to contain_exactly (
681- { id : '1' , range : 1.0 } ,
682- { id : '2' , range : 2.0 } ,
683- { id : '3' , range : 3.0 }
684- )
680+ expect ( results . to_a . first ) . to match [
681+ contain_exactly (
682+ { id : '1' , range : 1.0 } ,
683+ { id : '2' , range : 2.0 } ,
684+ { id : '3' , range : 3.0 }
685+ ) ,
686+ { last_evaluated_key : nil }
687+ ]
685688 end
686689
687690 it 'performs BatchDeleteItem with more than 25 items' do
@@ -790,14 +793,14 @@ def dynamo_request(table_name, scan_hash = {}, select_opts = {})
790793 it 'performs query on a table and returns items' do
791794 Dynamoid . adapter . put_item ( test_table1 , id : '1' , name : 'Josh' )
792795
793- expect ( Dynamoid . adapter . query ( test_table1 , hash_value : '1' ) . first ) . to eq ( [ id : '1' , name : 'Josh' ] )
796+ expect ( Dynamoid . adapter . query ( test_table1 , hash_value : '1' ) . first ) . to eq ( [ [ id : '1' , name : 'Josh' ] , { last_evaluated_key : nil } ] )
794797 end
795798
796799 it 'performs query on a table and returns items if there are multiple items' do
797800 Dynamoid . adapter . put_item ( test_table1 , id : '1' , name : 'Josh' )
798801 Dynamoid . adapter . put_item ( test_table1 , id : '2' , name : 'Justin' )
799802
800- expect ( Dynamoid . adapter . query ( test_table1 , hash_value : '1' ) . first ) . to eq ( [ id : '1' , name : 'Josh' ] )
803+ expect ( Dynamoid . adapter . query ( test_table1 , hash_value : '1' ) . first ) . to eq ( [ [ id : '1' , name : 'Josh' ] , { last_evaluated_key : nil } ] )
801804 end
802805
803806 context 'backoff is specified' do
@@ -834,21 +837,28 @@ def dynamo_request(table_name, scan_hash = {}, select_opts = {})
834837 it 'performs scan on a table and returns items' do
835838 Dynamoid . adapter . put_item ( test_table1 , id : '1' , name : 'Josh' )
836839
837- expect ( Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) . to_a ) . to eq [ [ { id : '1' , name : 'Josh' } ] ]
840+ expect ( Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) . to_a ) . to eq [ [ [ { id : '1' , name : 'Josh' } ] , { last_evaluated_key : nil } ] ]
838841 end
839842
840843 it 'performs scan on a table and returns items if there are multiple items but only one match' do
841844 Dynamoid . adapter . put_item ( test_table1 , id : '1' , name : 'Josh' )
842845 Dynamoid . adapter . put_item ( test_table1 , id : '2' , name : 'Justin' )
843846
844- expect ( Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) . to_a ) . to eq [ [ { id : '1' , name : 'Josh' } ] ]
847+ expect ( Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) . to_a ) . to eq [ [ [ { id : '1' , name : 'Josh' } ] , { last_evaluated_key : nil } ] ]
845848 end
846849
847850 it 'performs scan on a table and returns multiple items if there are multiple matches' do
848851 Dynamoid . adapter . put_item ( test_table1 , id : '1' , name : 'Josh' )
849852 Dynamoid . adapter . put_item ( test_table1 , id : '2' , name : 'Josh' )
850853
851- expect ( Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) ) . to match_array ( include ( { name : 'Josh' , id : '2' } , name : 'Josh' , id : '1' ) )
854+ expect (
855+ Dynamoid . adapter . scan ( test_table1 , name : { eq : 'Josh' } ) . to_a
856+ ) . to match ( [
857+ [
858+ match_array ( [ { name : 'Josh' , id : '2' } , { name : 'Josh' , id : '1' } ] ) ,
859+ { last_evaluated_key : nil }
860+ ]
861+ ] )
852862 end
853863
854864 it 'performs scan on a table and returns all items if no criteria are specified' do
0 commit comments