@@ -31,4 +31,41 @@ def self.folders
3131 end
3232 end
3333
34+ context "get_item_args should handle :occurrence_item_id" do
35+ class GetItemArgsAccessor
36+ include Viewpoint ::EWS ::ItemAccessors
37+ def call_get_item_args ( *args )
38+ get_item_args ( *args )
39+ end
40+ end
41+
42+ it "should handle an :occurrence_item_id hash" do
43+ occurrence_item_id = { :occurrence_item_id => { :recurring_master_id => 'rid1' , :change_key => 'ck' , :instance_index => 1 } }
44+ result = GetItemArgsAccessor . new . call_get_item_args ( occurrence_item_id , { } )
45+ result [ :item_ids ] . should eq [ occurrence_item_id ]
46+ end
47+
48+ it "should handle an Array of :occurrence_item_id hashes" do
49+ occurrences = [
50+ { :occurrence_item_id => { :recurring_master_id => 'rid1' , :change_key => 'ck1' , :instance_index => 1 } } ,
51+ { :occurrence_item_id => { :recurring_master_id => 'rid2' , :change_key => 'ck2' , :instance_index => 2 } } ,
52+ { :occurrence_item_id => { :recurring_master_id => 'rid3' , :change_key => 'ck3' , :instance_index => 3 } } ,
53+ ]
54+ result = GetItemArgsAccessor . new . call_get_item_args ( occurrences , { } )
55+ result [ :item_ids ] . should eq occurrences
56+ end
57+
58+ it "should handle an :id hash" do
59+ id = { :id => 'id1' , :change_key => 'ck1' }
60+ result = GetItemArgsAccessor . new . call_get_item_args ( id , { } )
61+ result [ :item_ids ] . should eq [ { :item_id => { :id => 'id1' , :change_key => 'ck1' } } ]
62+ end
63+
64+ it "should handle an Array of id strings" do
65+ ids = [ 'id1' , 'id2' , 'id3' ]
66+ result = GetItemArgsAccessor . new . call_get_item_args ( ids , { } )
67+ result [ :item_ids ] . should eq [ { :item_id => { :id => 'id1' } } , { :item_id => { :id => 'id2' } } , { :item_id => { :id => 'id3' } } ]
68+ end
69+ end
70+
3471end
0 commit comments