File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed
Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -159,14 +159,34 @@ def upload_file!(name, ext='csv')
159159
160160 end
161161
162+
163+ context "with callback procs options" do
164+ let ( :options ) { {
165+ before_import : proc { |_ |} ,
166+ after_import : proc { |_ |} ,
167+ before_batch_import : proc { |_ |} ,
168+ after_batch_import : proc { |_ |}
169+ } }
170+
171+
172+ it "should call each callback" do
173+ expect ( options [ :before_import ] ) . to receive ( :call ) . with ( kind_of ( ActiveAdminImport ::Importer ) )
174+ expect ( options [ :after_import ] ) . to receive ( :call ) . with ( kind_of ( ActiveAdminImport ::Importer ) )
175+ expect ( options [ :before_batch_import ] ) . to receive ( :call ) . with ( kind_of ( ActiveAdminImport ::Importer ) )
176+ expect ( options [ :after_batch_import ] ) . to receive ( :call ) . with ( kind_of ( ActiveAdminImport ::Importer ) )
177+ upload_file! ( :authors )
178+ expect ( Author . count ) . to eq ( 2 )
179+ end
180+ end
181+
162182 end
163183
164184 context "with invalid options" do
165- let ( :options ) { { invalid_option : :invalid_value } }
185+ let ( :options ) { { invalid_option : :invalid_value } }
166186
167- it "should raise TypeError" do
168- expect { add_author_resource ( options ) } . to raise_error ( ArgumentError )
169- end
187+ it "should raise TypeError" do
188+ expect { add_author_resource ( options ) } . to raise_error ( ArgumentError )
189+ end
170190
171191 end
172192
You can’t perform that action at this time.
0 commit comments